Hi. In my theme, the category links show up as:
http://domain.com/wp/category/mycat
For backward compatibility of URLs, I would like to remove the bold word in that URL ("/category") because wordpress in fact works if I remove that. Just the name of the category ("mycat" in my example) is fine to bring up the category archive without any problem.
Thanks for any tips!
use a rewrite
I think it's not an issue of doing a rewrite, because the theme itself writes the URLs. I want to change how the category URL is linked from within the theme while calling wp_list_categories.
So the "/category" is autmatically added by WP!
I checked the options for this function:
http://codex.wordpress.org/Template_Tags/wp_list_categories
But there seems to be none that allows me to personalize the word used for "category".
You can change the word to anything you like on the Options->Permalink page, but you cannot remove it. The identifier is needed to signal that you are asking for a category.
As for why it works without it, let me guess: Your Custom Permalink string starts with /%category% , right? If it didn't, then leaving it out would not work.
Removing it entirely would require a large rewrite of the internal rewrite and query system. Using category in the custom permalinks is a bit of a hack anyway, since there is not a one-to-one correspondence between categories and posts; posts can have more than one category.
Thanks for a very informative post!
I found the "category base" works for me.
I have a site that automatically lists the categories prefixed with "domain-name/category/directory-name".
If you create a navigation menu and simply hard-code "domain-name/directory-name", I've discovered that it works just the same; The hard-coded urls also get indexed like every other page on your website or blog.
- I've used this technique on my sites that I want to ensure the url and directory can easily be memorized.
However, in most cases, if you dont have a SEO keyword in your domain name, I recommend using the "category" structure and replace that with an industry keyword.
Using "/." (without quotes) as the category base should work
Hmm... it did work, but not anymore.
Seems not to work all the time, anyone know why?
Use the top level categories plugin, if you want to remove the prefix altogether.
You must log in to post.
You are viewing a mobilized version of this site...
View original page here