WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 2 down vote accepted

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!

share|improve this answer
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!! – Quantastical Dec 19 '15 at 20:06



After your register_taxonomy() function

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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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