I'm working on a site that will in part house information on products that many people have worked on in different roles. I'd like for people, the projects they've worked on, and their roles in the projects to be searchable using custom taxonomies. Projects and People are custom post types.

Let's use a movie as an example. That's not what the site is for, but the problem is exactly the same:

  • Alice worked on Big Movie as the director and producer.
  • Bob worked on Big Movie as an actor.
  • Carl worked on Big Movie as the scriptwriter.
  • David worked on Big Movie as another scriptwriter.

I want to be able to search for all directors, search for everyone related to Big Movie, and search for everything Alice worked on (and Bob, and Carl, etc.).

So far I've simply skimmed the codex and my thought is to have a hierarchical taxonomy "People" associated with the post type. Every entry will have two levels:

  • Role
    • Name

So the "People" taxonomy of Big Movie might look like this:

  • Producer
    • [Alice's Person post ID]
  • Director
    • [Alice's Person post ID]
  • Writer
    • [Carl's Person post ID]
    • [David's Person post ID]
  • Actor
    • [Bob's Person post ID]

Is there a better or more efficient way to associate people posts with their particular roles on particular project posts? Does this approach actually solve the problem and allow for efficient searches for people based on the roles they have played, the roles they have played in particular projects, and the particular projects they have worked on?

1 Answer 1


Taxonomies are probably not the best option: There is still no table for term meta data, and if you are using a people custom post type plus a taxonomy of the same name, you will have a hard time keeping everything synchronized.

Install the plugin Posts 2 Posts, register a connection between people and movies:

function connect_people_movies() 
            'name' => 'people_movies',
            'from' => 'people',
            'to' => 'movies'
add_action( 'p2p_init', 'connect_people_movies' );

See the plugin’s wiki for more instructions and examples.

  • I'd rather not use a plugin and become dependent on someone else's code that could become orphaned at any time. The custom post type and taxonomy name can easily be made unique, if that's the hurdle with using taxonomies. I am also thinking this sort of thing must come up often with people who seriously develop with WordPress. Surely this wheel has already been invented and addressed?
    – jeremiahs
    Commented Nov 27, 2012 at 5:32
  • 1
    The Posts 2 Posts plugin is that wheel. It is used by thousands of developers and if Scribu will stop the work one day there will be someone else continuing the development. See core.trac.wordpress.org/ticket/14513 for the Trac discussion.
    – fuxia
    Commented Nov 27, 2012 at 5:43
  • Scribu is a core WP developer and I don't think he's going anywhere. In fact, I read something from Matt Mullenweg recently (iirc) that discusses more robust taxonomy and post relationship features using the P2P plugin as a base/example is in the roadmap for Core in the next year or two. Posts 2 Post is also hands down the best solution for this, I was about to post the same answer toscho did.
    – Ennui
    Commented Aug 2, 2013 at 13:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.