I have a custom post type called "artists". Attached to this is a custom taxonomy, genre
.
Now, URLs /genre/<post slug>
works perfectly fine, however the naked taxonomy page /genre/
gives a 404 error, and I'm struggling to find the error in my code that would do this.
This is my code:
// Genre
add_action( 'init', '_ct_genre', 0 );
function _ct_genre() {
$label_p = 'Genrer';
$label_s = 'Genre';
register_taxonomy( 'genre', 'artists', array(
'labels' => array(
'name' => $label_p,
'singular_name' => $label_s,
'menu_name' => $label_p,
'all_items' => 'Alla ' . strtolower($label_p),
'parent_item' => 'Förälder',
'parent_item_colon' => 'Förälder:',
'new_item_name' => 'Nytt namn på ' . strtolower($label_s),
'add_new_item' => 'Ny ' . strtolower($label_s),
'edit_item' => 'Redigera ' . strtolower($label_s),
'update_item' => 'Uppdatera ' . strtolower($label_s),
'search_items' => 'Sök ' . strtolower($label_p),
'add_or_remove_items' => 'Lägg till eller Ta bort ' . strtolower($label_p)
),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_admin_column' => true,
'show_in_nav_menus' => true,
'has_archive' => true,
'show_tagcloud' => true,
'update_count_callback' => '_update_post_term_count',
'query_var' => true,
'publicly_queryable' => true,
'rewrite' => array(
'slug' => 'genre',
'with_front' => true,
'hierarchical' => true
)
) );
}
All similar issues on StackExchange that I have found, does not apply here.
- I've tried setting
query_var
to a string 'genre' instead, however that didn't work either. - I have of course flushed permalinks after each and every change.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745041010a4607806.html
评论列表(0条)