Category Base not working (permalinks)
I set the permalinks on Custom Structure
with these settings: /postCategory/%category%/%postname%/
. Also I installed Category Base
in postCategory
. And it won't work. When I visit the post page, I get the page not found.
This gives:
for posts: example.org/postCategory/%category%/%postname% // this will output page not found
for categories: example.org/postCategory/%category% // this works
It only doesn't work when I use the same word for Category Base
and for the prefix in the url of the post (in this case postCategory
).
So this doesn't work:
Custom Structure: /postCategory/%category%/%postname%/
Category Base: postCategory
and this will work:
Custom Structure: /postCategory/%category%/%postname%/
Category Base: postCategories
So my questions are how can I get this to work. To have the same word for Category Base
and in permalinks for posts.
These are my persistent settings:
http://pokit.org/get/img/8a33b710bf98f9e3658edaaf8343cc3b.jpg
EDIT:
I found something similar here:
But I really don't understand how to set this "add_rewrite_rule" function for my case:
I have this problem with my custom post type: "product" and custom taxonomy: "product_cat" and you want to use "vaporizers" for the category base and in permalinks for "product"
So this is my desired setup for permalinks:
http://pokit.org/get/img/bad3b8bea220768b60bb73d49657974a.jpg
And the result for the category should be:
www.example.com/vaporizers/product_cat_name
For the product:
www.example.com/vaporizers/product_cat_name/product_name
source to share
The reason it doesn't work is because the internal category rewrite rule takes precedence over the permalink structure rules (for example, category rewrites come after the rewrite). So example.org/postCategory/%category% is interpreted as example.org/index.php?category_name=postCategory/%category% and obviously WordPress cannot find such a category by returning a 404 page. It will never search for posts after a failure in a category.
The only work around is to give one more base to the category or position ... just like in you, "and it will work." They must be different, there is no other way.
source to share