I have created a Custom Post type and its own respective taxonomy.

I have for example this URL structure: http://www.example.com/faq/category/sub-category/test-post/

The same content can also be accessible through this link: http://www.example.com/faq/category/test-post/

How can I write a rewrite so the second URL is not available especially for google SEO perspective and avoid duplicate content

1 Answer 1


Your taxonomy is set to 'hierarchical' => true, do you have the post included in both the parent and child category?

If you untick the parent category and only tick sub-category then it should use the first URL only.

  • Alex, No I don't have in both categories only 1. But Im doing some custom functions in order to get the post and the taxonomy using the same slugs. I am following this post: themoonwatch.com/en/2012/…
    – Jojo
    Jan 29, 2019 at 15:58
  • @jojo not sure, if i would work with a solution from 2012.. try to find something more recent..
    – honk31
    Jan 29, 2019 at 17:10
  • @honk31 - Do you have any solution for what I would like to achieve? I wan to create a custom WordPress Rewrite Rule to Combine Taxonomy and Post Type with unlimited number of taxonomies
    – Jojo
    Jan 29, 2019 at 17:30
  • @Jojo please create a new question here on se with all your goals. paste in the code, that you have and lets try to solve it..
    – honk31
    Jan 29, 2019 at 17:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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