Register Taxonomy for Custom Post Type Tag page not working

I am using the 2017 theme with a custom post type Bookmark

add_action( ‘init’, ‘create_bookmarks_post_type’ );
function create_bookmarks_post_type() {
$labels = array(
‘name’ => __( ‘Bookmarks’ ),
‘singular_name’ => __( ‘Bookmark’ ),
‘add_new_item’ => __( ‘Add Bookmark’ ),
‘add_new’ => __( ‘Add Bookmark’ ),
‘edit_item’ => __( ‘Edit Bookmark’ ),
‘featured_image’ => __( ‘Bookmark Image’ ),
‘set_featured_image’ => __( ‘Upload Bookmark Image’ ),
‘remove_featured_image’ => __( ‘Remove Bookmark Images’ ),
‘menu_name’ => __( ‘Bookmarks’),
);

$args = array(
‘labels’ => $labels,
‘public’ => true,
‘publicly_queryable’ => true,
‘show_ui’ => true,
‘show_in_menu’ => true,
‘query_var’ => true,
‘rewrite’ => true,
‘capability_type’ => ‘post’,
‘has_archive’ => true,
‘hierarchical’ => true,
‘menu_position’ => 25,
‘taxonomies’ => array( ‘bookmark_category’, ‘bookmark_tag’ ),
‘supports’ => array( ‘title’, ‘editor’, ‘author’, ‘thumbnail’, ‘excerpt’, ‘custom-fields’, ‘revisions’ )
);
register_post_type( ‘bookmark’, $args);
}

And I have the following taxonomy:

//create two taxonomies, genres and tags for the post type “tag”
add_action( ‘init’, ‘create_bookmark_tag_taxonomy’, 0 );

//create taxonomy bookmark_tags for the post type “bookmark”
function create_bookmark_tag_taxonomy()
{
// Add new taxonomy, NOT hierarchical (like tags)
$labels = array(
‘name’ => _x( ‘Tags’, ‘Bookmark Tags’ ),
‘singular_name’ => _x( ‘Tag’, ‘taxonomy singular name’ ),
‘search_items’ => __( ‘Search Tags’ ),
‘popular_items’ => __( ‘Popular Tags’ ),
‘all_items’ => __( ‘All Tags’ ),
‘parent_item’ => null,
‘parent_item_colon’ => null,
‘edit_item’ => __( ‘Edit Tag’ ),
‘update_item’ => __( ‘Update Tag’ ),
‘add_new_item’ => __( ‘Add New Tag’ ),
‘new_item_name’ => __( ‘New Tag Name’ ),
‘separate_items_with_commas’ => __( ‘Separate tags with commas’ ),
‘add_or_remove_items’ => __( ‘Add or remove tags’ ),
‘choose_from_most_used’ => __( ‘Choose from the most used tags’ ),
‘menu_name’ => __( ‘Tags’ ),
);
register_taxonomy(‘bookmark_tag’,’bookmark’,array(
‘hierarchical’ => false,
‘labels’ => $labels,
‘show_ui’ => true,
‘update_count_callback’ => ‘_update_post_term_count’,
‘query_var’ => true,
‘rewrite’ => array( ‘slug’ => ‘bookmark_tag’ ),
));
}

Everything works properly -except- that the Tag page throws a 404.

Eg. This URL works:

example.com/bookmark_category/whatever

Eg. This URL throws a 404:

example.com/bookmark_tag/whatever

What am I doing wrong?

Read more here:: Register Taxonomy for Custom Post Type Tag page not working

Leave a Reply

Your email address will not be published. Required fields are marked *