In my plugin I have a custom post type with a slug of 'ready-to-wear' and I have a custom taxonomy called 'seasons' associated with it.

The odd thing is that this url with query works:


but the same one with custom permalink doesn't:


It throws a 404 error. You can try pasting the links yourself.

Here is my relevant plugin code:

Here is where the custom post type is registered

$post_types = array();

    $post_types['rtw'] =  $args = array(
        'labels' => array(
            'name' => __('RTW Collections'),
            'singular_name' => __('Ready to Wear Collection'),
            'add_new' => __('Add new RTW collection'),
            'add_new_item' => __('Add a new show to the RTW collection'),
            'edit_item' => __('Edit Collection'),
            'view_item' => __('View Collection'),
            'search_items' => __('Search Ready to Wear Collections'),
            'not_found' => __('No RTW Collections found'),
            'not_found_in_trash' => __('No RTW Collections found in trash')
        'query_var' => 'rtw_collections',
        'supports' => array('title', 'editor', 'thumbnail', 'author', 'comments'),
        'has_archive' => true,
        'publicly_queryable' => true,
        'show_ui' => true,
        'taxonomies' => array('seasons','city'),
        'rewrite' => array(
            'slug' => 'ready-to-wear',
            'with_front' => false
        'public' => true,
        'menu_position' => 6

Here is where the taxonomy is configured:

$taxonomies = array();

    $taxonomies['seasons'] = array(
        'query_var' => 'seasons',
        'rewrite' => array(
            'slug' => 'seasons',
            'with_front' => false
        'single_value' => true,
        'required' => true,
        'labels' => array(
            'name' => __('Seasons'),
            'singular_name' => __('Season'),
            'edit_item' => __('Edit Season'),
            'update_item' => __('Update Season'),
            'add_or_remove_items' => __('Add or remove seasons'),
            'new_item_name' => __('Add new Season'),
            'all_items' => __('All Seasons'),
            'search_items' => __('Search Seasons'),
            'popular_items' => __('Popular Seasons'),
            'separate_items_with_commas' => __('Separate Items with commas'),
            'choose_from_most_used' => __('Choose from most used Seasons')

and here is the call to register_taxonomy:

foreach ($taxonomies as $taxonomy => $arr) {
            register_taxonomy($taxonomy, null, $arr);

I have tried:

  • Flushing the permalinks repeatedly
  • Setting 'with_front' true and false repeatedly
  • add flush_rewrite action to my functions.php

Unfortunately, none of these work. Please help me out.


I solved this issue by making sure that the calls to register my taxonomies were placed before the calls to registering my custom post types. Weird but it works!

  • 3
    OMG thank you for this!!! i was tearing my hair out. No idea why that fixed all the mysterious issues I've been having but it did. THANKS! – Michelle Jan 23 '14 at 22:57
  • I swear, I have been searching for this answer for two weeks. I will be embedding the link in the comments of my code! F-YEAH!! – Jeff Jenkins Dec 19 '15 at 20:06



After your register_taxonomy() function

  • 2
    Please add an explanation to your answer: why could that solve the problem? – fuxia Jul 11 '14 at 11:23
  • 1
    Flushing rewrite rules on every request comes with a huge performance drawback. – kaiser Jul 11 '14 at 11:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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