Help Center

How to Create Relations Between Posts

How to Create Relations Between Posts

Discover how to build relationships between Custom Post Types using the JetEngine plugin on your WordPress website.

Before you start, check the tutorial requirements:

  • Elementor (Free version) or Block editor (Gutenberg)

  • JetEngine plugin installed and activated with Custom Post Type created and several posts added. If you have not done this yet, please follow this tutorial

JetEngine allows setting different types of relations. For now, as part of the Refactored Relations feature, you can build relations between Custom Post Types, Custom Content Types, users, and taxonomies. 

In this article, we revise the Custom Post Types relations.

Building a Relationship

Head to the WordPress Dashboard > JetEngine > Relations directory and push the “Add New” button to build a new relationship.

If you have already created some relations, you can also click on the “Edit” button next to the existing item to open the relations editor.

jetengine relations list

General Settings

Set a Name for the relation and select the created post types as Parent object and Child object in the corresponding drop-down menus.

Proceed to the Relation type selector and pick the suitable option

Once the type is defined, you can set the Parent relation if desired.

jetengine relationship general settings

The following toggles allow registering more controls for the related items.

registering controls for wordpress relationship
  • Related controls for parent object — enable to add controls of the related children to the parent object;
  • Allow to create new children from parent — toggle to allow creating new children from the parent object page;
  • Register controls for child object — enable to add controls of the related parent to the child object;
  • Allow to create new parents from children — toggle to allow creating new parents from the child object page;
  • Register separate DB table — switch to create a new database only for the current relation. Otherwise, the data will be stored in the global relations database.

Labels

If desired, set the custom labels for the controls or leave them empty to see the default labels.

jetengine relationship labels

Meta Fields

This tab allows setting meta fields for the relationship as a unit. Push the “New Field” button to add a new meta field.

jetengine relationship new field button

Adjust the needed amount of the meta fields.

relationship default meta fields settings
  • Label — set a label that will be displayed next to the meta field;
  • Name/ID — define a value stored in the database. Mind that this field should include only lowercase Latin letters with no spaces. Use “-” and “_” symbols to separate words;
  • Field type — select the meta field type that will be displayed when the field in the post is being edited;
  • Description — type in a meta field description if you want to show additional information about the field next to it;
  • Is required — switch on to make the field obligatory for completing.

After making all the changes, push the “Add Relation” button.

Parent Post Type Editor

The editor will appear in the custom post type posts, both in the parent and child post types.

Let’s check the parent post type. Return to the WordPress Dashboard and head to the custom post type you have set as a Parent object.

Click on the “Edit” button next to any post to which you want to add related children.

parent custom post type posts list

As we have opened the parent object post type, head to the Children … tab. Here you can add, edit and delete all the needed posts as related child items. You can read more about the controls in this article.

Once the connections are made, press the “Update” button.

parent post related items editing

Repeat the previous steps for all the posts you want to relate with child posts.

Child Post Type Editor

If you want to work with the child object, return to the WordPress Dashboard and proceed to the post type you have set as a Child object

Click on the “Edit” button next to any item to which you want to add related parent posts.

child custom post type posts list

Go to the Parent … tab. Here you can set and delete relations with the parent object posts.  

Don’t forget to update the post to save the result. This way, you can relate any children posts you need with parent post type items.

child post related items editing

This is it; the WordPress CPT relation is set. Now you know how to relate items with one another using the JetEngine plugin.

Was this article helpful?
YesNo

Need help?

Ask Facebook community

Get answers from 22K Crocoblock Community experts from all over the world.

Start a live chat

Ask question to support agent and share its details via chat messages.