Post type child of another post type

This may be a stupid question but is it possible to have a post type child of another post type?

Let me explain with an example:

Read More

I created 2 post types, “Actors” and “Galleries”.

What i want is to create a new actor like “Winona Ryder” and a new gallery like “Winona Pictures”.

The adress in the browser bar should be;
www.mysite.com/actors/winona-ryder/galleries/winona-pictures

Also this should affect breadcrumbs as well.
I guess i have to play around with permalinks.

Can anyone take a look at this and tell me if this is possible?

Many thanks in advance. And sorry for any bad English

Related posts

Leave a Reply

4 comments

  1. Attachments are post types someway, when you attach images to a post/page and display them in your post, you get a link like your-post-title/attachment/filename/.

    Maybe you can create post types with hierarchical option and them filter the link to replace the attachment to post parent name instead.

  2. Regarding the child association, you cannot have it by default. I have implemented a similar scenario (Company CPT > Job CPT). I store the company id as the post meta of a particular job custom post, to indicate that that job/those jobs belong to this company. You can try that. And for URLs, yes, you’re gonna have to work hard for it! 😉

  3. Could you post some of your code?

    I believe you may need a slug rewrite or a flush. You could also try going to your permalink structure and just hitting save. By doing this, you are having WordPress rewrite the .htaccess file so it can use the new custom post type.