Post relations

24 Nov 2021 0

The post relationships are treated as a normal meta field box.

After selecting the post-relationship field type the Related post and relationship box will appear:

Select the related post type and then the relationship type.

At the moment self-post relationships are not allowed.

If you select a Bidirectional reaction (see below) a new box called Inversed field on target post will be displayed.

Choose the corresponding field type. Automatically this field type will be set as Post relationship (inversed of the selected one).

Relationships types

  • One to One – Unidirectional: The current post type can be related to one post type
  • One to One – Bidirectional: The current post type can be related to one post type and there is an inversed field on the target post
  • One to many – Unidirectional: The current post type can be related to many post types
  • One to many – Bidirectional: The current post type can be related to many post types and there is an inversed field on the target post
  • Many to one – Unidirectional: Many posts belonging to the current post type can be related to one post type
  • Many to one – Bidirectional: Many posts belonging to the current post type can be related to one post type and there is an inversed field on the target post
  • Many to many – Unidirectional: Many posts belonging to the current post type are related to many post types
  • Many to many – Bidirectional: Many posts belonging to the current post type can be related to many post types and there is an inversed field on the target post

Example

Suppose you have two custom post types: one called Florist and one called Flower.

The Florist may have many flowers, and any flower belongs to only one Florist.

Create a field called flowers on Florist and a field called florist on the Flower (create them as simple text).

Then, go to Florist and transform the flowers fields in a One to many bidirectional relation: select Flower as post type and florist as field target.

You are done! automatically on the Flower side, the florist field is now a Many to one bidirectional relation.

Display

At the moment the related post(s) are displayed as simple links (post title is used as anchor text).

20% Discount!


Use this code during check-out:

ACPT_2024_PROMO_20

Valid for all products*

*This coupon code is valid for all products and plans. The promotion expires April, 30th 2025 00:00:00 UTC

This will close in 20 seconds