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 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


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' )
    // ...


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

Appreciate any help on the matter.

share|improve this question

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

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.