I have a big problem. I have been banging my head on this all day long. It seems to be a stupid easy question. Possibly also with a stupid easy answer. But I can’t seem to find it.
What I want is simple. I have a custom_post_type called “producten” and a taxonomy called “producten_categorie”. Inside there I have got some couple hundred products that are all assigned to a “produten_categorie” term. I want to change the permalinks so they display the taxonomy term in the product permalink.
What I have now is as follows:
- www.domain.com/producten/ (producten archive)
- www.domain.com/producten/category (producten category archive)
- www.domain.com/producten/category/subcategory (producten subcategory archive)
- www.domain.com/producten/post_tile (single page for post in “producten”)
What I want is the following:
- www.domain.com/producten/ (producten archive)
- www.domain.com/producten/category (producten category archive)
- www.domain.com/producten/category/subcategory (producten subcategory archive)
- www.domain.com/producten/category/post_tile (single page for post in main category)
- www.domain.com/producten/category/subcategory/post_tile (single page for post in sub category)
I can’t get it to work. I first tried the “custom post type permalinks” plugin. Which did not work and gave me 404 errors. Even after flushing the permalinks more than a few times.
After that I tried manually changing the permalink by using “filter_post_type_link”. But I just can’t get it to work.
You can find my code for registering the post type on the taxonomy here -> http://pastebin.com/DMfA21qb
Hope someone can help me.