
WordPress does not provide a native way to model real relationships between content items such as posts, users, and terms.
Most solutions rely on post meta or taxonomies, which become difficult to query, scale, and maintain over time.
If you’ve outgrown ACF relationship fields or post meta arrays, Native Content Relationships introduces a structured relationship layer for WordPress that allows you to define meaningful, queryable, and scalable relationships between content — without relying on hacks or editor-specific solutions.
This plugin is designed to be core-friendly, developer-focused, and future-proof, built specifically for developers who have hit performance walls.
• Many-to-many relationships between content
• Clean querying without meta or taxonomy abuse
• Long-term maintainability and portability
• Cleanly handles headless and REST WordPress setups
• Relationships between posts, users, and terms
• One-way or bidirectional relationships
• Indexed database table for fast queries
• Clean PHP API for managing relationships
• WP_Query integration
• REST API support with inline relations
• Multilingual-ready (WPML / Polylang)
• WooCommerce optional integration
• Editor- and theme-agnostic
• Post Post
• Post User
• Post Term
• User Post
• Term Post
Posts
• Products Accessories
• Courses Lessons
• Articles Related content
Users
• Favorite posts
• Bookmarked content
• Multiple authors or contributors
Terms
• Featured categories
• Curated collections
• Semantic grouping beyond default taxonomies
• Relationship management in post editor
• User profile relationship management
• Term editor relationship support
• AJAX-powered search for posts, users, and terms
• Modern UI matching WordPress admin style
Schema stable from 1.x onward. Backward compatibility guaranteed.
We lock the core before expanding. Ecosystem and agency confidence depend on it.
NCR_SCHEMA_VERSION are stable in the 1.x line. Any future schema change will be additive (new columns/indexes) or run through a documented migration; no breaking table or column renames without a major version.ncr_ (functions, hooks, options), NCR_ (classes, constants), ncr- (CSS/IDs/handles). No new alternate prefixes; documented and consistent so extensions and ecosystem plugins can rely on a stable surface.Native Content Relationships is built for high-volume enterprise and headless WordPress sites. Forget the performance bottleneck of post-meta.
type_lookup) and a smart query planner optimized for performance.Benchmarks confirm stable performance with 1,000,000+ relationship rows under InnoDB.
View Full Performance Report
If you store relationships in Advanced Custom Fields relationship fields or standard Post Meta, you can safely migrate to Native Content Relationships to unlock immediate performance and querying benefits.
A built-in script allows you to selectively migrate ACF related data into the new performant table, allowing you to gradually refactor out technical debt.
Check out the dedicated one-time migration guide here: docs/migration/from-acf.md
Built to be a complete content relationship modeling engine:
content_relation argument directly into your WP_Query with parameters specifically designed for advanced use cases: include multiple relationship types, apply exclusionary rules, combine OR/AND relations, or filter by minimum/maximum thresholds. For decoupled and highly dynamic solutions, Native Content Relationships includes powerful headless optimizations:
Append ?naticore_relations=1 or ?_embed=relations into your standard core endpoint fetches (e.g., wp/v2/posts) to embed related data inside your response arrays instantly, minimizing round trips.
• WooCommerce (product relationships)
• WPML / Polylang (relationship mirroring)
• Elementor (dynamic content support)
• Gutenberg (related content block)
• Advanced Custom Fields (one-time migration tool)
Elementor:
* Compatible with: Elementor 2.0+
* Features: Comprehensive Dynamic Tags suite for relationships
* Auto-detected: Yes (no configuration needed)
* Tested up to: Elementor 3.20
Elementor Dynamic Tags:
* Related Posts: Display related posts with customizable output formats
* Related Users: Display users with relationships (favorites, bookmarks, etc.)
* Related Terms: Display taxonomy terms with relationships
* Flexible Output: IDs, titles, links, avatars, count-only options
* Direction Support: Both outgoing and incoming relationships
* Native Controls: Relationship type selector with validation
Gutenberg:
* Compatible with: WordPress 5.0+ (Core)
* Features: “Related Content” block with relationship filtering
* Always available: Yes (core WordPress feature)
* Tested up to: WordPress 6.5
Use these in posts, pages, or widgets. They use the current post ID when not specified.
Related posts (default: type=related_to, limit=5):
[naticore_related_posts type=”related_to” limit=”5″ order=”date” layout=”list” title=”Related Content” class=”my-class”]
Related users (default: type=authored_by):
[naticore_related_users type=”authored_by” limit=”10″ order=”name” layout=”list” title=”Authors”]
Related terms (default: type=categorized_as):
[naticore_related_terms type=”categorized_as” limit=”5″ order=”name” layout=”grid” title=”Categories”]
Attributes (all shortcodes):
* type – Relationship type slug (e.g. related_to, parent_of, authored_by, categorized_as)
* limit – Number of items (1–50), default 5
* order – Sort: date, title (posts) or name (users/terms)
* post_id – Post ID; omit to use current post
* layout – list or grid
* title – Heading text above the list (optional)
* class – Extra CSS class(es) for the wrapper
* show_thumbnail – 1 to show post thumbnail (posts shortcode only), default 0
* excerpt_length – Number of words for excerpt (0 = hide), default 0
Related Content (NCR) is available under Appearance Widgets. Add it to any sidebar or widget area.
Output matches the shortcode (same markup and styles when the shortcode CSS is enqueued).
This section is intended for developers who want programmatic control.
Add a relationship:
wp_add_relation( $from_id, $to_id, $type );
Get related items:
wp_get_related( $id, $type );
Check relationship:
wp_is_related( $from_id, $to_id, $type );
Remove relationship:
wp_remove_relation( $from_id, $to_id, $type );
new WP_Query( array(
‘post_type’ => ‘post’,
‘content_relation’ => array(
‘post_id’ => 123,
‘type’ => ‘related_to’,
),
) );
Endpoints available under:
/wp-json/naticore/v1/
• Create relationships
• Fetch related content
• Delete relationships
Embed relations in core REST responses (headless):
Add ?naticore_relations=1 to any core resource request to include a naticore_relations array in the response. Works with:
• GET /wp-json/wp/v2/posts/<id>?naticore_relations=1
• GET /wp-json/wp/v2/users/<id>?naticore_relations=1
• GET /wp-json/wp/v2/categories/<id>?naticore_relations=1 (and other taxonomies)
Each relation item includes to_id, to_type, type, and optional title/display_name/name. Opt-in only so default requests stay fast.
Actions:
• naticore_relation_added
• naticore_relation_removed
• naticore_after_duplicate_post – fired after copying relations from one post to another (args: from_post_id, to_post_id, result array)
Filters:
• naticore_relation_is_allowed
• naticore_get_related_args
Duplicate post: Use helper naticore_copy_relations( $from_post_id, $to_post_id, $relation_types = null ) to copy relationships when duplicating a post. Returns array with keys copied, skipped, errors. Out-of-the-box integration: Yoast Duplicate Post, Post Duplicator (metaphorcreations), Copy & Delete Posts (Inisev).
This plugin provides comprehensive Elementor Dynamic Tags for displaying relationships in Elementor-powered designs.
Available Dynamic Tags:
Related Posts (ncr-related-posts)
Related Users (ncr-related-users)
Related Terms (ncr-related-terms)
Usage Examples:
Display related post IDs:
[ncr-related-posts relationship_type="related_to" output_format="ids" limit="5"]
Display user avatars:
[ncr-related-users relationship_type="favorite_posts" output_format="avatar_images" avatar_size="48"]
Display term links:
[ncr-related-terms relationship_type="categorized_as" output_format="term_links" limit="10"]
Get count of related items:
[ncr-related-posts relationship_type="related_to" output_format="count"]
Advanced Features:
– Context-aware: Automatically detects current post, user, or term context
– Fallback content: Display custom text when no relationships found
– Pagination support: Limit results for performance
– Ordering options: Sort by date, title, or random
– Multi-language: Works with WPML/Polylang translations
Integration Benefits:
– Native Elementor experience: Tags appear in Elementor’s Dynamic Tags panel
– No templates forced: Users control output format and styling
– Performance optimized: Uses cached relationship data
– Optional dependency: Only loads when Elementor is active
• List relationships
• Add / remove relationships
• Integrity checks
Contributions are welcome.
GitHub: https://github.com/chetanupare/WP-Native-Content-Relationships
GPLv2 or later