We'll create fresh WordPress site with MB Relationships installed. You have 20 minutes to test the plugin after that site we'll be deleted.
MB Relationships helps you create relationships between posts, pages, custom post type, terms and users. The plugin is lightweight and optimized for database and query performance.
The plugin allows you to create connections from posts to posts, posts to pages and so on. Then you can perform corresponding queries to retrieve posts that are connected to or from given posts.
It supports reciprocal and bi-directional relationships.
Post relationships is a missing part in WordPress. The only “built-in” way that mimic the post relationship in WordPress is the post_parent
for pages where you can create many child pages of a page (a one-to-many relationship). Unfortunately, that’s available for pages and hierarchical post types only. Besides, it’s not many-to-many relationship.
Below are some examples of posts to posts relationships that might help you see the benefit of this feature:
The simplest example is to manually create related posts in your WordPress website. When you edit a post, you can select posts that have similar or related content and display them in the frontend for further reading.
You can also query backward: displaying posts that link to the being read post as a reference to provide more information to your readers. With this, you don’t need a WordPress related posts plugin anymore.
Suppose you have two custom post types, event and band, where:
If people want to buy tickets, they could search for events in their location and see what bands are playing on a given date, or they could search for bands they like and see what date they are playing near their location.
In this example, we have created many-to-many relationships between events and bands.
MB Relationships allows you to create bi-directional connections. You will be able to query back and forth without any problem.
The data is stored in the database as a pair of (from_id, to_id), thus making it independent from either side.
Besides, for each side, there’s a meta box that shows what are connected from/to. So you don’t have to worry about the direction of the connection anymore.
MB Relationships is very much inspired by the popular plugin Posts 2 Posts which is not maintained anymore. We have taken the idea and made some improvements. The codebase and data structure is very similar.
WP_Query
,get_terms
and get_users
. See documentation for more information.This plugin is a free extension of Meta Box plugin, which is a powerful, professional solution to create custom fields and custom meta boxes for WordPress websites. Using MB Relationships in combination with other extensions will help you manage any content types in WordPress easily and make your website more professional.
If you like this plugin, you might also like our other WordPress products: