WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to rewrite only one category ?

I have a category "Photos" and just for this category.

I just want to rewrite it from /category/photos to /photos

share|improve this question
up vote 3 down vote accepted

You can do this with a rewrite rule from within WordPress. Take a look at the documentation for add_rewrite_rule.

Something like this:

add_action('init', 'wpse65855_rewrite');
function wpse65855_rewrite()
        '^photos/?$', // the rule regex
        'index.php?taxonomy=category&term=photos', // where you want the rule to go
        'top' // the priority. Make this one go first

You can stick that in a plugin.

The downside here is that this is not very portable. You assume that the "Photos" category slug will always be photos, which might not be true on all WP installs. If this is something for yourself, that's not a big deal -- you can be sure that everything works out the way you need it to. If it's something you're going to use with clients or release publicly, you'll need to do more to make it flexible. Like add an admin page where folks can select the category that the /photos base rewrites to, for instance.

share|improve this answer
PERFECT !!! You are amazing. – Steffi Sep 21 '12 at 14:41

You can change the Category Base in Settings -> Permalinks to:




However these solutions don't always work properly.

You can also try adding a rewrite rule to your .htaccess file:

RewriteRule ^category/(.+)$ http://www.example.com/$1 [R=301,L]
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.