I´m trying to create the following URL structure:

example.com/attractions                     <-- post type archive
example.com/attractions/taxonomy_term       <-- taxonomy archive
example.com/attractions/van-gogh-museum     <-- custom post type

Unfortunately this isn´t possible by default: WordPress needs the taxonomy base in the URL, as SE user sanchothefat wrote in his answer to this question:

...if you don't want the taxonomy-slug to be there then you're out of luck, you can't have the same slug as your post type or another taxonomy as it won't know what term is from which taxonomy and what's a post.

In other words, WordPress needs this permalink structure:


My question: Is there a way to make this work using WordPress rewrite API?

I suppose it involves 2 steps:

  1. Removing the taxonomy base from the URL
  2. Tell WordPress what post type it needs to display

Update #1

I found a code snippet that should remove the taxonomy base from the URL:

global $wp_rewrite;
$wp_rewrite->extra_permastructs['taxonomy_base'] = array('%taxonomy_base%', EP_NONE);

(Source - see last answer on bottom of page)

This isn´t the complete solution though, since WordPress can´t tell if the post is a taxonomy archive or a post type...

Update #2

The author of this great article on Advanced Taxonomy Queries with Pretty URLs wrote me:

What you're asking isn't too difficult, but it could be a bit tricky. The rewrite rules need to know what type of thing the second term is(..) That's why the category/tag/taxonomy name prefix is prepended. You could create a rewrite so that everything after /attractions/ is treated as a taxonomy URL, but doing both gets a little tricky.

Update #3

For anyone having the same issue, have a look at this discussion on WordPress Answers. Especially MikeSchinkel´s plugin code might help.

Here´s an interesting example of WPCandy combining the taxonomy base and term in the URL: http://wpcandy.com/pros/experienced/with-multisite

  • Did you ever get this to work?
    – Richard B
    Mar 14, 2012 at 13:28
  • Unfortunately not, I moved on to other things after update #3. I still need to find a solution for this issue though.
    – Mattvic
    Mar 14, 2012 at 17:44

2 Answers 2


I just added a plugin to the Wordpress Directory that removes the slug base for any custom taxonomy and the default category taxonomy. You can find it here - http://wordpress.org/extend/plugins/wp-no-taxonomy-base/


Recently I came across the same situation, and after a day spent searching for a solution and couldn't find any, I wrote my own working solution.

The trick is to use Wordpress wp_rewrite, and to add your URLs to it when Wordpress generates its permalinks on the beginning.

I've wrote a simple function to do it all automatically and explained everything on my blog (don't want to paste the same code twice), so feel free to check it out ;)



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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