Archive for Parent Taxonomy not working (404 error)
-
Hi, I created a taxonomy (not a post type, only a taxonomy) called Books. Here’s my code:
function add_custom_taxonomies() { $labels = array( 'name' => 'Books', 'singular_name' => 'Book', 'search_items' => 'Search Books', 'popular_items' => 'Popular Books', 'all_items' => 'All Books', 'parent_item' => 'Parent Book', 'parent_item_colon' => 'Parent Book:', 'edit_item' => 'Edit Books', 'update_item' => 'Update Book', 'add_new_item' => 'Add New Book', 'new_item_name' => 'New Book Name', 'separate_items_with_commas' => 'Separate Books with commas', 'add_or_remove_items' => 'Add or remove Books', 'choose_from_most_used' => 'Choose from the most used Books', 'menu_name' => 'Books', ); $capabilities = array ( 'manage_terms' => 'manage_options', 'edit_terms' => 'manage_options', 'delete_terms' => 'manage_options', 'assign_terms' => 'edit_posts' ); register_taxonomy('Books','post',array( 'hierarchical' => true, 'labels' => $labels, 'capabilities' => $capabilities, 'has_archive' => true, 'show_ui' => true, 'show_admin_column' => true, 'update_count_callback' => '_update_post_term_count', 'query_var' => true, 'rewrite' => array( 'slug' => 'Books' ), )); } add_action( 'init', 'add_custom_taxonomies', 0 );
It works fine, I added terms like Thriller, Romance… I can access the archive page for each term:
But the archive page for all my Books taxonomy doesn’t work, I get a 404 error!
I created taxonomy-books.php so it should work but I don’t know what I did wrong… I checked several sources for creating taxonomies and the code in my functions.php seems to be fine. If anyone knows why the archive for my Books taxonomy doesn’t work, thank you for your help! ??
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘Archive for Parent Taxonomy not working (404 error)’ is closed to new replies.