Adds a content menu to WordPress admin where all your post types that are used for content can live, when doing this the post type configured to use content menu will be removed from the admin menu and if you have a lot of post types you will see a more clean admin menu than before.
Both post
and page
will be moved to content menu by default and can be unmoved by content_menu_post_types
filter.
Content menu will only have submenu items when a post type is selected so you can see and use the submenu items for that post types, as you can see in the second screenshot.
composer require frozzare/wp-content-menu
To move your post types into content menu you can set content_menu
to true
in register_post_type
or use content_menu_post_types
filter.
// With `register_post_type`
register_post_type( 'book', [
'content_menu' => true
] );
// With the filter.
add_filter( 'content_menu_post_types', function ( $post_types ) {
return ['page', 'post', 'book']
} );
You can modify Add New Book
label by content_menu_add_new_item_label
filter.
add_filter( 'content_menu_add_new_item_label', function ( $label ) {
return 'Add New';
} );
Disable content menu for users:
add_filter( 'content_menu_user_allowed', function ( $allowed, $user ) {
return false;
}, 10, 2 );
Everyone is welcome to contribute with patches, bug-fixes and new features.
MIT © Fredrik Forsmo