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.

I have a custom post called "A".

I have created another custom post called "B".

I want the hierarchy of B to be a sibling of A, that is

http://www.mysite.com/A/B/name-of-post

I have A as a custom post type because I want to change the layout, and make it loop through all the items of A and B has another style of it's own.

Everything works, when I see the archive of A I see the posts for type A, and same as B (see the posts of B) but when I click on the archive of B to see each individual post, I get NOT FOUND (and yes I have gone to permalink settings).

These are my rules:

For post type A:

$args = array(
    // ... other args removed for clarity
    'rewrite' => array( 'slug' => 'A' )
    // ...
);

For POST TYPE B:

$args = array(
    // ... other args removed for clarity
    'rewrite' => array( 'slug' => 'A/B' )
    // ...
);

Appreciate any help on the matter.

share|improve this question
add comment

1 Answer 1

Okay the answer is simple (was able to fix this myself).

What you need to do is put another directory (let's call it C) where the rewriting rules will be made.

So for post type B, it would be:

$args = array(
    // ... other args removed for clarity
    'rewrite' => array( 'slug' => 'A/C/B' )
    // ...
);

It's a bit cumbersome but it works nevertheless.

share|improve this answer
add comment

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.