Why do I get 404 for my custom taxonomy?
add_action('init', 'custom_taxonomy_flush_rewrite');
function custom_taxonomy_flush_rewrite() {
global $wp_rewrite;
$wp_rewrite->flush_rules();
}
add_action('init', 'create_publication_categories');
function create_publication_categories() {
$args = array(
'label' => __('Categories'),
'has_archive' => true,
'hierarchical' => true,
'rewrite' => array(
'slug' => 'topics',
'with_front' => false
),
);
$postTypes = array(
'publication'
);
$taxonomy = 'publication';
register_taxonomy($taxonomy, $postTypes, $args);
}
So I have the template called taxonomy-publication.php
, but I still get 404.
I have reset the permalink following this. And other answers such as this and this.
But I still get 404. Any ideas what I have missed?