[Support request] Remove GP Metabox – CPT

Home Forums Support [Support request] Remove GP Metabox – CPT

Home Forums Support Remove GP Metabox – CPT

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #469267
    wekhter

    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.

    #469368
    Leo
    Staff
    Customer Support

    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.

    #469554
    wekhter

    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).

    #469741
    Tom
    Lead Developer
    Lead Developer

    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.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.