Wordpress - Remove slug in taxonomy url

This by default is not possible, and using the CPT and Custom Tax registration APIs, is not possible.

And for good reason.

It's all to do with permalink and slug clashes, and removing ambiguity. Admittedly there are cases where unique URLs that never overlap are not allowed by the system for this reason ( false negative ).

So I recommend you decide on a replacement for 'exhibitor_filters' such as 'exhibitors', or 'filters' and use that as your slug in the rewrite option when registering.

If you really want to do it the way you desire however, you will need to add rewrite rules. This can be problematic, as you run the real risk of clashes ( do we load the page 'about' or the exhibitor_filter term 'about'? ), and the ordering and priorities of your hooks will play a big role.

e.g.

function ex_rewrite( $wp_rewrite ) {

    $feed_rules = array(
        '(.+)'    =>  'index.php?exhibitor_filter='. $wp_rewrite->preg_index(1)
    );

    $wp_rewrite->rules = $wp_rewrite->rules + $feed_rules;
}
// refresh/flush permalinks in the dashboard if this is changed in any way
add_filter( 'generate_rewrite_rules', 'ex_rewrite' );

The above code will work for individual terms, though it will need modifying for heirarchical URLs and taxonomies.

Place the code in functions.php of your theme, or your themes associated plugin.

Warning: You will need to be careful not to have clashing permalinks, and you will need to be aware of the ordering of which rules come first. Use the monkeyman rewrite analyser plugin to test this. You have been warned.


There is a plugin that will easily let you remove the taxonomy slug with a few clicks. Anyway as Tom said be careful for example not naming two different taxonomies terms the same or everything will brake.

Plugin url is http://wordpress.org/extend/plugins/wp-htaccess-control/