I'm having a small issue with category pages for a custom taxonomy when custom permalinks are used, and I was wondering if someone might be able to help out and point out where I'm going wrong.

I've created a taxonomy "Brands" for use with a custom post type (in this case, Products), using the code below place in the functions.php file of the theme. I've created a page template for the Brands page, which lists all the brands using the wp_list_categories($args) template tag, and that's all fine.

Now, if I use Wordpress' default permalink settings (where you get urls ending with ?page_id=7 and similar), clicking on any of those brands in the list, takes you to a category page which lists all the products for that brand - which is exactly the intent. If however, I set any other custom permalink structure (say /xyz/%postname%/ ), when you click on the brand name I get the 404 page instead of the category page (the same also happens when clicking view on a Brand when viewing the list within the Wordpress admin).

With the custom permalink structure, when clicking on the brand it appears to be using the correct url structure (http://www.siteroot.com/brands/brandname/) when showing the 404 page. With the default permalink setting it goes to http://www.siteroot.com/?brand=brandname, which works correctly.

I've checked various guides on making custom taxonomies, and have tried to be very careful with setting the rewrite for the taxonomy, and now I'm at a loss as to what the issue is. Any help will be much appreciated.

add_action( 'init', 'build_taxonomies', 0 );

function build_taxonomies() {  

    'labels' => array(
        'name' => 'Brands',
        'singular_name' => 'Brand',
        'search_items' => 'Search Brands',
        'popular_items' => 'Popular Brands',
        'all_items' => 'All Brands',
        'parent_item' => 'Parent Brand',
        'parent_item_colon' => 'Parent Brand:',
        'edit_item' => 'Edit Brand',
        'update_item' => 'Update Brand',
        'add_new_item' => 'Add New Brand',
        'new_item_name' => 'New Brand Name'
        'hierarchical' => true, 
        'public' => true,
        'show_ui' => true,
        'sort' => true,
        'query_var' => true,  
        'args' => array('orderby' => 'term_order'),
        'rewrite' => array('slug' => 'brands', 'with_front' => false)


  • Did you rebuild the rewrite rules by visiting the Permalinks page in Settings and saving? Oct 23, 2011 at 17:16

4 Answers 4


Add flush_rewrite_rules(); after your register taxonomies. That fixed it for me.


Do make sure you do it on install of your plugin if you're using it on one. It should only be run once on pug-in activation - and not on every page load. Alternatively visit Settings > Permalinks page as this flushes the rules too.

  • 3
    But make sure it doesn't run on every request!
    – fuxia
    Apr 26, 2012 at 16:16
  • Make sure it doesn't run every request! +1000 Sep 8, 2013 at 1:01

If you use a permalinkg structure with a front base, make sure with_front is true.

  'rewrite' => array(
            'slug'          => 'brands',
            'with_front'    => true

I may be way off here (and this is an old question), but are you by chance using the WP No Category Base plugin? or have you in the past on this site?

I found that when I disabled the plugin, I would get similar results to the ones you are describing.

I also had an issue with a single category listing "no posts found".

I never figured out what caused the problem, but I fixed it. My method is posted on the WordPress.org forums.


What finally worked for me was changing a value when defining the taxonomy properties. If you set 'rewrite' => false, then it should not give you any more problems, and you'll even be able to set the permalinks to whatever you want without giving any troubles to you custom taxonomy :)

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.