Search code examples
wordpresstaxonomy

Remove Wordpress Custom Taxonomy Base


I am using custom taxonomies with WordPress 3.0.4

Does anyone how to remove the taxonomy base from the URL?

I have seen plugins that do it for categories and tags, but not for custom taxonomies.

For example, I have a custom taxonomy called 'cities'. I would like my URL structure to be mydomain.com/newyork instead of mydomain.com/cities/newyork

Is there a function or something I can use?


Solution

  • http://codex.wordpress.org/Function_Reference/register_taxonomy

    If you look there, you'll see a 'rewrite' argument which you can see to true. This argument also takes an argument of 'with_front' which defaults to true... which is why you have the 'front' of the taxonomy.

    When creating your custom taxonomy, set those arguments as you wish, and you'll be away :)

    If it is you who has set up this custom taxonomy, then you're able to actually set the with_front argument to false which will stop this happening. If you look here:

    http://codex.wordpress.org/Function_Reference/register_taxonomy

    You'll see the 'rewrite' argument and just below that, you'll see the 'with_front' part.