Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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:

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

share|improve this question

4 Answers 4

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

share|improve this answer

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.

share|improve this answer

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! ;)

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

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.