Connected Custom Post Types (4 posts)

  1. Brian Hall
    Posted 4 years ago #

    Looking for opinions on best-practices connecting 2 Custom Post Types together, in a one-to-many or many-to-many situation.

    For example (1-to-many), creating an Author CPT and Book CPT (each with their own fields and data, but assigning an Author to a Book.

    For example (many-to-many), creating an Actor CPT and Movie CPT (each with their own fields and data), and assigning multiple Actors to multiple Movies.

    I'd like for them to function similarly to taxonomies, in that the URL structuring would look similar to:

    /author/Stephen-King/ (Stephen King's profile)
    /author/Stephen-King/books/ (List of SK books)

    /actors/Leonardo-di-Caprio/ (Leo's profile)
    /actors/Leonardo-di-Caprio/films(Leo's movies)
    /movies/Titanic/ (Titanic's synopsis, screenshots, etc...)
    /movies/Titanic/actors/ (list of Titanic's cast)

    For both scenarios, it would be preferable to keep both CPTs under the same "Books" or "Movies" section in the Admin area, but this isn't strictly required.

    What do you think? Anyone done something similar? I'm not actually building a book or movie website, but it seemed like an easy example of the type of connections I need to make.


  2. atheistponcho
    Posted 4 years ago #

    Were you able to find a solution to this? I'd like to do exactly the same thing.

  3. Brian Hall
    Posted 4 years ago #

    Unfortunately, no. I settled on a less elegant solution that involved adding some extra fields to taxonomies. Poor substitute for the solution I really wanted, but I didn't have the time to really research a solution.

    If you come up with something though, I'd love to hear about it!

  4. EliezerIsrael
    Posted 4 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic