Skip to content

Relationship Types

Relationship types define the kind of link between two objects (e.g. "related to", "parent of").

Built-in types (post–post)

TypeDirectionTypical use
related_toBidirectionalRelated posts, related products
parent_ofUnidirectionalParent–child (e.g. course → lessons)
referencesUnidirectionalCitations, references
depends_onUnidirectionalDependencies

Built-in types (user–post)

TypeDirectionTypical use
favorite_postsUser → postUser’s favorite posts
bookmarked_byUser → postUser bookmarks (same storage, different label)
authored_byPost → userMultiple authors / contributors

Built-in types (post–term)

TypeDirectionTypical use
categorized_asPost → termFeatured categories, curated collections

Object types

Each relation has a from (source) and to (target). Each side is one of:

  • post — Any post type (post, page, product, etc.)
  • user — WordPress user
  • term — Taxonomy term

A relationship type declares which from/to combinations are allowed (e.g. post → post, post → user).

Constraints

Types can define:

  • max_connections — e.g. at most one "author" per post
  • directionfrom_to, to_from, or bidirectional (see Direction)

Custom types

Register custom types with ncr_register_relation_type(). See Custom types.

Schema stable from 1.x onward. Backward compatibility guaranteed.