I've created a custom post type (book) and then a custom taxonomy (book_cat) just for this particular post type. It is working fine but if I click on All books page in the dashboard there's no column displaying which categories (book_cat) has a book been assigned to (if any). I need to click on each book to edit and see there.
The register new post type function is:
function post_types() {
register_post_type('book', array(
'supports' => array('title', 'editor', 'excerpt'),
'public' => true,
'labels' => array(
'name' => 'Books',
'add_new_item' => 'Add New Book',
'edit_item' => 'Edit Book',
'all_items' => 'All Books',
'singular_name' => 'Book'
),
'menu_icon' => 'dashicons-align-center',
'taxonomies' => array('book_cat')
));
}
add_action('init', 'post_types');
And the taxonomy is:
function books_init() {
$labels = array(
'name' => _x( 'Books Cat', 'taxonomy general name' ),
'singular_name' => _x( 'Book Cat', 'taxonomy singular name' ),
'search_items' => __( 'Search Book Cat' ),
'popular_items' => __( 'Popular Book Cat' ),
'all_items' => __( 'All Book Cats' ),
'parent_item' => null,
'parent_item_colon' => null,
'edit_item' => __( 'Edit BCat' ),
'update_item' => __( 'Update BCat' ),
'add_new_item' => __( 'Add New BCat' ),
'new_item_name' => __( 'New BCat Name' ),
'separate_items_with_commas' => __( 'Separate BCats with commas' ),
'add_or_remove_items' => __( 'Add or remove Bcats' ),
'choose_from_most_used' => __( 'Choose from the most used Bcats' ),
'menu_name' => __( 'Book Cats' ),
);
// create a new taxonomy
register_taxonomy(
'book_cat',
'book',
array(
'labels' => $labels,
'rewrite' => array( 'slug' => 'bcat' ),
)
);
}
add_action( 'init', 'books_init' );