0

Here is what I am looking for:

Custom Post Type: partner
Archive: domain.com/partners/ (list all partners)
Custom Taxonomy: country
Archive: domain.com/partners/denmark/ (list all partners in a country)
Custom Taxonomy: city
Archive: domain.com/partners/denmark/copenhagen/ (list all partners in a country and in city)
Single: domain.com/partners/denmark/copenhagen/the-name-of-the-partner-post/

On the custom post type rewrite I have the following:

$rewrite = array(
    'slug'                  => 'partners/%country%',
    'with_front'            => false,
)

It works fin with the following:

domain.com/partners/denmark/
domain.com/partners/denmark/copenhagen/
domain.com/partners/denmark/copenhagen/the-name-of-the-partner-post/

BUT I cannot find a rewrite solution that works with:

domain.com/partners/

1 Answer 1

0

There are probably a few ways to handle this, but I'm guessing the fact that you're using "/partners" in your taxonomy rewrites is messing things up for using "/partners" alone for the CPT.

I think I would probably use "/partners" for the CPT only, and then define a custom rewrite rule that determines what the parameters after the various slashes correspond to.

If you take a look at the examples on the reference page, you might get an idea of what I mean. Specifically, look at the one from Akira Tachibana on that page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.