I’m building a new plugin and need many-to-many relationships between two custom post types. From what I have read so far, this is not covered in the WordPress core (yet) and has been a subject of some debate for a few years now. Recently however the topic is very quiet. I believe the built in ability to make complex relationships between data will be necessary if WordPress wants to make the final transition to a full featured Content Management System. I love WordPress and I think skeptics will love it more if they had stronger control over their models.
A Quick History
Doing a search for “wordpress custom post type relationships” brings up several key articles that give a quick overview of the feature.
An article at wpcandy.com in 2011 by Brian Krogsgard titled About the Limitations of WordPress starts the conversation off. In it, Brian talks to developer Justin Tadlock. Justin claims (as of 2011) the use of custom posts and taxonimies can recreate a site like IMDB with a better implementation than they currently use. He points to three very well writen articles of his, that demonstrate the use of custom posts and taxonomies.
However, none of the articles really expand upon the question of many-to-many relationships, as not only is taxonomy and meta information too limiting, it apparently does not scale well either.
Brian and Justin point to a Trac ticket (14513) that asks the same question. The ticket was closed 2 years ago, only touched briefly by Andrew Nacin 5 months ago, when he pointed out sibling ticket #10657 should be opened up when the first is. Both tickets are currently at a ‘maybe later’ status.
In fact, Brian’s article sums up all my questions, I just want to revisit it. Has there been any development in this for the last 2 years? Version 3.8, a version dedicated to folding in popular plugins into the core. However, 3.8 is due in December is full to the brim of with features (including a front side editor!), so I doubt there is room for another.
Third Party Solutions
A few are third party plugins that seem to do the job well enough:
A plugin will get the job done it seems, even get the job done very well (especially scribu’s post2post plugin). However I am skeptical of starting plugin development by being dependent off another plugin right from the start (a search for “WordPress plugin dependency” reveals this is actually another point of contention).
Many-to-Many Relationship Solution
The solution I’ll be going with for now is scribu’s post 2 post plugin, which has rave reviews. The only problem with this, beyond the dependency on a secondary plugin, is that he just handed off the project recently and its future isn’t very clear. It would be nice to know as I enter serious WP development that support will be there for serious data management.
Upon further looking, I did find post-2-post-core, which should remove the need for dependancies, as it I can build it right in to my plugins.
The plugin seems fantastic though and kudos to scribu for all the work he’s done for the community.