To set up new and edit existing relationships, first go to the Toolset -> Relationships page.

When you create a new relationship, a wizard will appear that guides you through the different setup steps.

You can connect any post type (WordPress posts, pages, and custom post types) to other post types. First, choose the kind of relationship and then the type of post to be used on both sides of the relationship.

If you need relationships between users and posts, follow the tutorial on creating relationships and searches for users.

Relationship fields in many-to-many relations

Many-to-many relationships can include fields of their own. For example, if you are creating a many-to-many relationship between “songs” and “albums,” the relationship is that of specific songs appearing on specific albums. In this case, you probably want the relationship to include a field for the “track number” (the location in the album where the song appears).

This is how the aforementioned relation would appear:

Relationship Fields in Many-To-Many Relations

When you include fields in the relationship, you actually create an intermediary post type that holds these fields.

The intermediary post type appears as a double one-to-many relationship for the two post types in the many-to-many relationship.

Although the intermediary post type stores additional information and offers additional functionality, using it has no performance implications on looking up related content. Toolset looks it up without having to load the intermediary posts.

The following table summarizes what you can do when you have a many-to-many relationship with “relationship fields.”

Here, we will continue to use the example of an albums < tracks > songs relationship.


When looking at object…When you are…You can…
AlbumEditing an albumConnect songs

Connect tracks

Displaying an albumDisplay all connected songs with a View

Display all connected tracks with a View

SongEditing a songConnect albums

Connect tracks

Displaying a songDisplay all connected albums with a View

Display all connected tracks with a View

TrackDisplaying a trackDisplay the connected album

Display the connected song

Relationship names

The final step in setting up a relationship is to give it a name. You can have several relationships between the same post types. Therefore, names that clearly express your relationships are crucial.

For example, let us consider airports and flights.

Airports have many flights. Each flight departs from one airport and arrives at another. The correct way to connect airports and flights is to set up two one-to-many relationships. We call one “departures” and the other “arrivals.”

Naming Your Post Relationship
Naming Your Post Relationship

Because we give each of these similar relationships a unique name, we can reference them separately. In this manner, when we display a flight, we can show both arrival and departure airports. Similarly, we can create a View that will show all arrival and departure flights for a specific airport.

Toolset will set a default name for the new relationships that you have established. Your site will be easier to manage if you consider what each relationship implies and create a meaningful name for each.

Once you have set up relationships between posts, you can start connecting posts based on these relationships.

You can connect posts that you have already saved. This means that when you first create a new draft of a post, you must save or publish it before you can connect it with other posts.

You will see each of the available relationships (relationships that involve the post type you are editing) as a metabox on the post editing page. For example, when you edit an airport, you will see boxes for the arrival and departure relationships.

Post Relationships of Flight Departures and Arrivals

You can connect existing posts or create new posts.

To disconnect posts, hover over them in the connections table and additional options will appear.

Removing a Connection Between Two Posts

The Disconnect operation will retain both posts and only disconnect them. The Delete operation will both disconnect and delete the selected post (move it to Trash).

Deleting post connections

You can also delete connections that you have created. By default, an intermediary post is deleted together with the connection between parent and child posts. If necessary, you can disable this option during the creation or editing of a relationship. However, we do not recommend disabling it unless there is a very good reason. Especially not if your intermediary post type is not publicly visible.

What’s next?

How to display related posts with Toolset