Archived topic
Remove GP Metabox - CPT
3 replies · Started by wekhter on January 12, 2018
Hi Tom,
I've found various posts on the forum about removing individual metaboxes from GP Premium on a CPT (ex. remove page header, sidebar layout, etc), but since the change to have them all included in one tabbed metabox is there a new way to remove all of them at once? I have a few non-front-facing CPTs I'd like to make as simple as possible for editors I'm collaborating with.
Hi there,
You should be able to just change the metabox capability using this hook: https://docs.generatepress.com/article/generate_metabox_capability/
To see some examples, search generate_metabox_capability on this forum.
Hi Leo,
When I mentioned the editors I didn't mean I wanted to hid the meta boxes from them, that's just why I'm finally bothering to do anything about it (previously I was the only person editing the site so I didn't care as much). I need the meta boxes gone for the specific CPT regardless of anyone's capabilities, it's not a front-facing CPT (no permalinks).
Hi there,
This should do it:
add_action( 'add_meta_boxes', 'tu_remove_layout_meta_box', 999 );
function tu_remove_layout_meta_box() {
remove_meta_box('generate_layout_options_meta_box', 'your_post_type', 'normal');
}
If it's not a public post type, you can set the public parameter when registering the CPT to false. That way the metabox won't show up in the first place.