I have default post type "post" and created custom post type "restaurants". I have categories (not taxonomy): cat1 and cat2. I want to work with same categories on both post types and I don't want to create taxonomy for custom post type. If I visit site.com/cat1 or site.com/cat2 I will see posts which contain these categories. I need to make archive pages for cpt like this: site.com/restaurants/cat1 site.com/restaurants/cat2

I can easily do that by adding rewrite rules. But I think this is not a perfect way: for example, sitemap.xml will not contain these pages.

Do you know the way to implement it correctly?

  • If it works, it seems perfect enough to me. Adding cpt's to sitemap is very separate and a plugin thing, and it will take care of it when you select the option. But I never recommend sharing a taxonomy like category between post types. – Knut Sparhell Oct 5 '19 at 20:59
  • @KnutSparhell ty. I think I will add links to Yoast's sitemap by using hooks. – Roman Sarvarov Oct 5 '19 at 21:17

Your Answer

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

Browse other questions tagged or ask your own question.