Archived topic
Remove layout options metabox
7 replies · Started by Robert on December 14, 2017
Hello,
I'd like to be able to remove the layout options meta box for non admins so they don't go messing up the pages, is this possible?
Would you be able to supply me with the code to remove the page header meta box that shows just on posts? I would like editors to still be able to select the page header on a page if necessary.
Do you want to remove them or set it so that admin still has access?
https://docs.generatepress.com/article/generate_metabox_capability/
https://codex.wordpress.org/Roles_and_Capabilities
Just the admin. I feel like it's going to confuse editors lol.
Hmm they should be admins only already according to Tom here: https://generatepress.com/forums/topic/show-gp-metaboxes-only-to-admin/#post-218620
I'm talking about this page header sub menu: https://cl.ly/0W1N2C37040s and this: https://cl.ly/0J0K3e1H290o. The new metabox that has the multiple tabs doesn't show BUT the page header shows to editors.
The Page Header actually has a separate filter to use: generate_page_header_metabox_capability
So you would use that instead of generate_metabox_capability
For the menu item, try this:
function wpse28782_remove_menu_items() {
if ( ! current_user_can( 'administrator' ) ) {
remove_menu_page( 'edit.php?post_type=generate_page_header' );
}
}
add_action( 'admin_menu', 'wpse28782_remove_menu_items' );