I used the custom structure /%postname%/
but when I click on a category link, I'm getting this
/%category%/%postname%/
and what's odd, category shows as the actual word category, and not the name of the category
Yep, I'm confused
I used the custom structure /%postname%/
but when I click on a category link, I'm getting this
/%category%/%postname%/
and what's odd, category shows as the actual word category, and not the name of the category
Yep, I'm confused
I think you are using the wrong terminology.
By "Category link" are you referring to the URL for the category? In which case it would not show a post name, since a category is not a post itself.
And if it is showing the word "category" then it would presumably be the following (missing the %):
/category/%postname%/
It should work, as Ryan pointed out above.
However, note this strongly emphasized point in the Codex [emphasis in original]:
%category%
A sanitized version of the category name (category slug field on New/Edit Category panel). Nested sub-categories appear as nested directories in the URI. Starting Permalinks with %category% is strongly not recommended for performance reasons.
WP TurnKey - Turn-Key WordPress installation and maintenance services
WordPress user since 2005 | @chip_bennett | chipbennett.net | cbnet Plugins
Thanks for pointing that out Chip, I wasn't aware of the performance issues associated with doing that.
I think the OP is looking at category archives on the front end.
I don't think so. If it were a category archive URL, it would look like www.url.com/category/%category%/ not www.url.com/category/%postname%/
Even clicking on a post permalink from a category archive would end up displaying the single post, using the post permalink structure, not the category archive permalink structure.
Oddly (given the stern warning linked above), the Codex listing displays the following image:
Note the custom permalink structure displayed.
WP TurnKey - Turn-Key WordPress installation and maintenance services
WordPress user since 2005 | @chip_bennett | chipbennett.net | cbnet Plugins
You shouldn't start the permalink string with any of %postname%, %category%, %tag%, or %author%.
All of these cause the same performance impact, which is known in the code as "use_verbose_page_rules". Basically, when you use one of those as the starting piece, the rewrite matching system has to generate individual rules for every Page, then check those first. If you have lots of pages, this is a big hit to the system. In some cases, merely generating the list of URLs to check has been known to cause timeouts or SQL query size problems, which can lead to gigantic page generation times on the front end.
If you don't have lots of Pages, it won't hurt you much. By "lots", I'm talking in the 50+ range of Page count.
AHA! So that's why a ton of Pages get all those rewrite rules. huh.
Otto is my favorite person right now. I'd run up against this but didn't know *why* or in what situations it would affect things.
I can illustrate this rather simply, actually. Consider this site:
Page named "AAA"
Page named "BBB"
Page named "CCC"
Bunch of posts with permalink "%year%/%postname%"
Page rewrite rules will basically be the following:
example.com/robots.txt
example.com/feed/*
example.com/comments/* (for comments feeds)
example.com/search/*
example.com/category/%category%
example.com/tag/%tag%
example.com/author/%author%
example.com/%year%/%month%/%day% (with each of those after year being optional)
example.com/%year%/%postname% (this is the permalink string you define)
example.com/%pagename%
The way that system works is that it compares to each of those URLs in turn, from the top of that list to the bottom. When one matches, then it knows what to display and what templates to call and such.
The thing to note is that the order is significant. Every one from the top down is *less* specific than the previous one. Note that it also knows year/month/etc should be numeric. So a non-number won't match %year%. And then finally, %pagename% matches everything, but fails in the query, thus tripping the 404 condition.
But if you define your permalink string with one of those four non-numeric fields, then that method will never reach the pagename rule, will it? If it's /%category%/%postname% now for example, then the %category% will match anything just as well as %pagename% will. It's just a string, and a user defined one at that. So the rules now have to be more verbose, and they change to these:
example.com/robots.txt
example.com/feed/*
example.com/AAA
example.com/BBB
example.com/CCC
example.com/ (this is a root rewrite condition, to recognize the site root page)
example.com/comments/* (for comments feeds)
example.com/search/*
example.com/category/%category%
example.com/tag/%tag%
example.com/author/%author%
example.com/%year%/%month%/%day% (with each of those after year being optional)
example.com/%category%/%postname% (this is the permalink string you define)
Same thing as before, except the pages moved up in the list and are now individually specified. And the resulting list has the same property: The list gets less and less specific as you go down it, until the last rule can match anything. Remember that %whatever% is basically considered an optional field in all cases. example.com/something would give you a category archive for the "something" category with the above setup.
And that's how the rewrite system actually works. :)
OK, sorry it took me so long to get back. You don't want to know why, LOL.
First, I was tired when I posted. I should have included a link to the site.
It is still a work in progress.
http://waynecountynow.org/
I used custom structure, /%postname%
I did NOT use /%category%/%postname%/
Yet if you go to the site and click on a category, like Activities, this is what I get
http://waynecountynow.org/category/activities/
Note the word category inserted in the middle![]()