I have a custom taxonomy, artist, that is related to three custom post types: videos, posts and letters. I have an taxonomy-artist.php template that should display the archive for a given artist.
When I visit /artist/ARTIST_NAME it will display the taxonomy archive template only if there are no other posts associated with it. If there are posts associated with it, you get redirected to an individual post (I believe it's the oldest post associated with the taxonomy term). So if I visit /artist/ARTIST_NAME and there is content associated with it, I get kicked out to [videos|letters|posts]/THE_POST_NAME.
I saw something about needing to have taxonomies registered before custom post types, so I am registering the taxonomy first and I've flushed out my permalink settings, but no luck. I'm stumped as to why this would be happening, so I would appreciate any ideas about what would cause this!
Here's the code I'm using for registering the taxonomy and post types:
register_taxonomy( 'artist',
array(
'videos',
'letters',
'post'
),
array(
'labels' => array(
'name' => _x( 'Artists', 'taxonomy general name' ),
'singular_name' => _x( 'Artist', 'taxonomy singular name' ),
'search_items' => __( 'Search Artists' ),
'all_items' => __( 'All Artists' ),
'parent_item' => __( 'Parent Artist' ),
'parent_item_colon' => __( 'Parent Artist:' ),
'edit_item' => __( 'Edit Artist' ),
'update_item' => __( 'Update Artist' ),
'add_new_item' => __( 'Add New Artist' ),
'new_item_name' => __( 'New Artist Name' ),
'menu_name' => __( 'Artists' ),
)
)
);
register_post_type( 'letters',
array(
'labels' => array(
'name' => __( 'Letters' ),
'singular_name' => __( 'Letter' )
),
'public' => true,
'has_archive' => true,
'supports' => array( 'title', 'editor', 'thumbnail' ),
'menu_icon' => get_stylesheet_directory_uri() . '/img/mail.png',
)
);
register_post_type( 'videos',
array(
'labels' => array(
'name' => __( 'Videos' ),
'singular_name' => __( 'Video' )
),
'supports' => array( 'title', 'editor', 'thumbnail' ),
'public' => true,
'menu_icon' => get_stylesheet_directory_uri() . '/img/blue-document-film.png',
)
);
register_post_type(),register_taxonomy(), andregister_taxonomy_for_object_type()code? – Chip Bennett Dec 20 '12 at 12:55register_taxonomy()afterregister_post_type(); add taxonomy support inside theregister_post_type()call itself (though I doubt either of these is the issue, if you are able to apply the taxonomy to all applicable post types); for testing purposes, apply the taxonomy only to one custom post type, and then see if the taxonomy archive index works as expected. – Chip Bennett Dec 20 '12 at 15:13