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

How to create a permalink structure which finish by:


Instead of:


By default, Wordpress is offering %category% tag strucure as "A sanitized version of the category name (category slug field on New/Edit Category panel".

How can I use the category name instead of category slug in permalinks?

Note that I dont need the easiest solution of making my slugs equal to my categories names. In fact, customer need to see in the area of edit post : the categories in a specific non-alpahbetical order. So I managed to do this by giving a digital number for the category as a slug and order showing categories by slug in an ASC mode using:

add_filter( 'get_terms_args', 'wpse_53094_sort_get_terms_args', 10, 2 );
function wpse_53094_sort_get_terms_args( $args, $taxonomies ) 
    global $pagenow;
    if( !is_admin() || ('post.php' != $pagenow && 'post-new.php' != $pagenow) ) 
        return $args;

    $args['orderby'] = 'slug';
    $args['order'] = 'ASC';

    return $args;

I think If I dont manage to use t f solution, I will look for a code or a plugin that adds meta field for categories and order by this field in ASC mode. Then I will rename my slugs to the same name of categories. What do you think about this approach?

Thank you for your comment

share|improve this question
Just out of curiosity, can't you simply edit your category slugs so that they match your category names? – WPMU-DEV Ari Apr 19 '13 at 16:43
I am answering your important question as an Edit note. thank you for your time. – whiteletters in blankpapers Apr 19 '13 at 16:55
For hierarchy purposes, another USEFUL way: use Custom_post_types instead of Categories, like here:<br/> wordpress.stackexchange.com/questions/28979/… – tazo todua Nov 10 '14 at 10:31
up vote 2 down vote accepted

I did not test this, but this should do what you want. Put the following in your functions.php:

add_filter('rewrite_rules_array', 'new_category_name_rewrite_rule');
function new_category_name_rewrite_rule($rules) {
    $new_rules = array();
    $categories = get_categories();
    foreach ($categories as $category) {
        $cat_name = preg_replace('#\s+#', '-', $category->name);
        $new_rules['/'.$category->slug.'/'] = '/'.urlencode($cat_name).'/';
    return $new_rules + $rules;
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.