I've created a custom taxonomy register as the code below, but it does not find the taxonomy-specialty.php nor archive.php templates (page not found error).
I did following (as recommended by other threads found on SE and the web): - re-save the permalinks - find the taxonomy settings page in wp-admin and when I hover over 'View' it points me to 'mysite.com/events/specialties/footology' for a 'Footology' taxonomy entry I created for a post of type 'event' - so the URL is as expected. However when visiting the link still get page not found error.
$specialty_args = array(
'hierarchical' => false,
// This array of options controls the labels displayed in the WordPress Admin UI
'labels' => array(
'name' => 'Specialty',
'singular_name' => 'Specialty',
'search_items' => 'Search specialties',
'all_items' => 'All specialties',
'edit_item' => 'Edit specialty',
'update_item' => 'Update specialty',
'add_new_item' => 'Add new specialty',
'new_item_name' => 'New specialty name',
'menu_name' => 'Specialties',
),
'show_ui' => true,
'show_admin_column' => true,
'query_var' => 'specialty',
// Control the slugs used for this taxonomy
'rewrite' => array(
'slug' => 'events/specialties', // This controls the base slug that will display before each term
'with_front' => false, // Don't display the category base before "/specialties/"
'hierarchical' => false
),
);
register_taxonomy('specialty', 'event', $specialty_args);
register_taxonomy_for_object_type('specialty', 'event'); //says in https://codex.wordpress.org/Function_Reference/register_taxonomy under 'Usage' to do this
I don't know what is wrong. Help appreciated, thank you!
init
action? are there posts assigned to the term you are viewing? what is your post type's URL structure and is it hierarchical?var_dump($wp_query)
in the 404 template and look at what WordPress is querying for.