Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have set up a custom taxonomy on a custom post type using the following: (For the sake of example, the custom post type is called newtype and the new taxonomy is just called newtax.

// Create Custom Post Type for newpost
add_action( 'init', 'create_post_type' );
function create_post_type() {
    register_post_type( 'x_newtype',
            'labels' => array(
                'name' => __( 'New Type' ),
                'singular_name' => __( 'New Type' )
            'public' => true,
            'has_archive' => true,
            'rewrite' => array('slug' => 'newtype'),
            'taxonomies' => array('category', 'post_tag'),
            'supports' => array('title','editor','excerpt','thumbnail')

// Add custom field for custom post type
function new_taxonomy() {
        'hierarchical' => true,
        'label' => 'New Tax',
        'query_var' => true,
        'rewrite' => array('slug' => 'newtax')
add_action( 'init', 'new_taxonomy' );

This works fine, but I had a question in regards to the URL redirecting.

Currently, if you go to it will redirect to . What is the best way to allow to load, without redirecting?

Thanks for reading.

share|improve this question
have you flushed your permalinks after setting: 'rewrite' => array('slug' => 'newtax') ? – moraleida Jun 4 '12 at 19:39
The permalink cache has been flushed by visiting Settings --> Permalinks --> Save. – Ryan Jun 4 '12 at 20:37

1 Answer 1

up vote 2 down vote accepted

What is the best way to allow to load, without redirecting?

You have to add a custom rewrite rule to make this work. Otherwise WordPress doesn't understand the newtax-term part of your permalink structure and redirects you to the URL which it does understand, which is %post_type%/%post_slug%.

If you want to understand how WordPress Rewrite API works, I would recommend you to read The Rewrite API: The Basics article. Spare no effort to learn it and you won't have issues with it.

share|improve this answer
Thanks for the reply! And I'm going to assume you mean /%post-slug%/ ;) Either way, the Rewrite API link looks like it will be very useful. – Ryan Jun 15 '12 at 16:58

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.