I've created a CPT named "decoration products"(productos decoración), the problem concerns to it CPT.
When for the first time I created "decoration products" CPT, I realized that it needed two level taxonomy uri structure. To visually illustrate it:
Root_domain/CPT name/- This is a page that shows all "decoration products" CPT's posts.
Root_domain/CPT name/category- This is an archive page that shows top level category's posts.
Root_domain/CPT name/category/subcategory- This is an archive page that shows subcategory's posts.
Root_domain/CPT name/category/subcategory/post-title- This is a post within a certain top category and subcategory.
I based on this post:
to create two level taxonomy uri structure for "decoration products" CPT. Anyway there were some fixes to do, for instance, double slash in the uri. I fixed it with this helpful post:
I create all my code based on above two posts and put it in functions.php. You can see it in pastebin.
I thought, that everything works well until I’ve realized that there’re some problems with the manner that WordPress handle CPT top-categories and child-categories URIs. These are the problems:
This interior illumination's post:
When I click on breadcrumb link “Iluminación interior” of this post, it must show “Iluminación interior” archive page, in the following uri:
Instead of 404 Page not Found (Error 404: Página no encontrada). If I change manually browser's uri to:
404 Page not Found error disappear and everything works well.
If I remove
function my_taxonomies_product() (you can find it above pastebin function.php code) and I click on breadcrumb link “Iluminación interior”, it shows archive page like I want but in the wrong uri:
"Interior illumination" (iluminación interior) is a subcategory of "Illumination" and the uri doesn’t show it, it should be: Root_domain/productos-decoracion/iluminacion/iluminacion-interior
This problems happens with all the other posts that have a top category and a subcategory.
The second problems comes when I click on breadcrumb link “Productos decoración” of many posts or categories pages, for instance here (
). Instead of bring to Root_domain/productos-decoracion (that’s what i want) it adds
%field% to the end of the uri.
%field% comes from functions.php code included above.
I've tried everything but with no success. I would really appreciate any help to fix this problems.