register_post_type( 'book', array( 'public' => false, 'show_ui' => true ) );
What will be the visible behavior in the WordPress admin dashboard?
register_post_type( 'book', array( 'public' => false, 'show_ui' => true ) );
The 'public' argument controls front-end visibility and queryability. Setting it to false hides the post type from front-end queries. However, 'show_ui' controls admin dashboard visibility. Since 'show_ui' is true, the post type appears in admin but not on the front-end.
register_post_type( 'movie', array( /* arguments here */ ) );
The correct argument to enable REST API support is 'show_in_rest'. Setting it to true makes the post type available in the REST API endpoints.
register_post_type( 'album', array( 'rewrite' => array( 'slug' => 'music' ), 'public' => true ) );
What will be the base URL slug for single 'album' posts?
register_post_type( 'album', array( 'rewrite' => array( 'slug' => 'music' ), 'public' => true ) );
The 'rewrite' argument with 'slug' set to 'music' means single posts of this type will have URLs starting with '/music/'.
register_post_type( 'event', array( 'public' => true, 'show_ui' => false ) );
What is the cause?
register_post_type( 'event', array( 'public' => true, 'show_ui' => false ) );
The 'show_ui' argument controls whether the post type appears in the admin dashboard menu. Setting it to false hides it from the menu even if 'public' is true.
The 'hierarchical' argument set to true allows the post type to have parent and child posts, similar to pages.