Navigation überspringen

What Are Post Relationships and How They Work in WordPress

Post Relationship is the connection between different posts (posts, pages, custom types) in a website.

Dauer

Post Relationship Helps Avoid Content Duplication and Ensure Consistency

Let’s look at an example to understand the power of post relationship. We’ll build a website for events. Each „event“ will list several „speakers“. Of course, each speaker can appear in different events.

Events with one common speaker

You could build this website with a single custom type called „events“ and list the speakers in a table.

Events content in editing

Now, let’s say that you want to update the image of a speaker. How do you do this? Without using post relationship, you’ll need to edit each of the events where this speaker is showing. If your site only has a few pages, that’s not a big deal. But what if your site lists thousands of events and speakers?

Post relationship solves this problem. There will be only one entry for each speaker. This entry will include all the details of a speaker. Different events featuring this speaker will only include a pointer to it. When anything changes in the speaker, it immediately shows in all the events that include it.

Multiple events linking to the same speaker

If we build this site with post relationship, we can do a lot more than only list the speakers for each event.

Speaker page

Create pages for speakers, listing the events they speak in

Events search by speaker

Allow to search for events according to speaker (and vice versa)

Export / Import

Easily export and import events and speakers

Welcome to the wonderful world of post relationships!