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

I wanted to rename the slug to use a custom rewrite with a prefix or suffix that I choose. For example, if the tag name is "product" I want to use a rewrite with a slug that says "product-powerpint-ppt" so the final URL will look like /tag/product-powerpoint-ppt instead of /tag/product

I was looking for a solution to this problem from time ago, without relying on htaccess rules, just tweaking WordPress or using a plugin. Anyone had the same question or can advice on a possible solution?

share|improve this question
up vote 0 down vote accepted

Filter 'term_link'. Sample code, not tested:

add_filter( 'term_link', 'wpse_72848_change_tag_slug', 10, 3 );

function wpse_72848_change_tag_slug( $termlink, $term, $taxonomy )
    if ( 'post_tag' !== $taxonomy )
        return $termlink;

    if ( 'product' === $term->slug )
        return str_replace( '/product/', '/product-powerpoint-ppt/', $termlink );

    return $termlink;
share|improve this answer
Hi @toscho, this worked straightforward. Thanks. I was able to rewrite the tags and other taxonomies using this snippet. However, when I try to access the url generated, I get a 404 error page. Do you know or have a clue how can I access the correct tag page when I use the link with the suffix? It may exist other similar filter to use. – julianm Nov 16 '12 at 15:50

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.