I’m building a WordPress site for a bookshop and want to create a custom post type called “Books” to manage book entries. I’ve added the following code to my theme’s functions.php file to register the post type:
function register_book_post_type() {
$args = array(
'public' => true,
'label' => 'Books',
'supports' => array('title', 'editor', 'thumbnail'),
'has_archive' => true,
'show_in_menu' => true
);
register_post_type('book', $args);
}
add_action('init', 'register_book_post_type');
I expected to see “Books” in the WordPress admin menu and create new book entries, but the post type doesn’t appear. I’m using WordPress 6.4 and PHP 8.0. I tried flushing permalinks via Settings > Permalinks, but it didn’t help. What am I missed in making the custom post type visible and usable?