WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am looking to create two custom post types, one of which is a child of the other. Let's call them Authors and Books for simplicity.

Authors should be a top level URL and the landing page for them should show a list of all their authored books. So you'd have something like:

http://mysite.com/Shakespeare/ http://mysite.com/Shakespeare/Macbeth http://mysite.com/Shakespeare/Othello

How do I create something like this in Wordpress? I am fine if it requires custom coding, just not sure how to express the relationship of post types to Wordpress.

share|improve this question

To me the most logical would be to have a "Book" custom post type, and then all the attributes of the books (Author, Collection, Genre, etc.) would be custom taxonomies.

Then for your URLs you could use some custom URL rewrite method to get what you want.

share|improve this answer

If it's a one-to-many relationship (an author can have multiple books, but a book can't have multiple authors), you can use the post_parent field in the posts table.

If it's a many-to-many relationship, you can use my Posts 2 Posts plugin.

To generate those urls, you can use the 'post_type_link' filter.

Finally, to match those URLs later, you can fall back to the page rewrite rule and manually parse the components (use the 'parse_request' action).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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