Building Addons
You can ship a separate plugin or theme that uses and extends Native Content Relationships.
Requirements
- Native Content Relationships installed and active.
- Use the public PHP API, WP_Query, and hooks.
- Register custom types with ncr_register_relation_type.
Checklist
- Dependency check — Ensure NCR is loaded (e.g.
class_exists( 'NATICORE_Relation_Types' )orfunction_exists( 'ncr_add_relation' )) before calling its API. - Relation types — Register your types on
init(priority 20 or later) so they appear in admin and in queries. - Hooks — Use
ncr_relation_added/ncr_relation_removedfor side effects (e.g. cache invalidation, sync to another system). - Filters — Use
ncr_get_related_argsorncr_max_relationshipsto adjust behavior without forking the plugin.
Distribution
- Do not bundle or rename the main plugin; require it as a dependency and document it in your readme.
- Follow WordPress plugin guidelines and the Stability & Backward Compatibility notes when relying on specific API shapes.
See Extension hooks for additional integration points.