Site logo

Archived topic

Is possible to hide this box in my CPT

9 replies · Started by Fernando on October 29, 2018

Viewing posts 1–10 of 10

Dear support
I want to hide these GP options in my cpt "programas" since I want my client does not get confused when creates/edit one of them.

Is that possible?
Best regards

Thank you Leo
I'll take a look.
Regards

No problem :)

Sorry bother again but I am beginner about use filters.
Could you please provide me the code I should insert in function.php in order to just to hide this metabox in non-admin users?
Best regards

If you don't mind, I'd also like to know how to use in specific CPTs :)

You can do this:

add_action( 'add_meta_boxes', function() {
    remove_meta_box('generate_layout_options_meta_box', 'programas', 'normal');
}, 99 );

Hi Tom
Thanks for replying a Sunday. One question:
With your code, am I hiding this box for admin users as well?
I just need to hide for non-admin users
Regards

Tom, this is the code that works for me:

add_action( 'add_meta_boxes', 'tu_remove_layout_meta_box', 999 );
function tu_remove_layout_meta_box() {
  if ( ! current_user_can( 'administrator' ) ) {
	remove_meta_box('generate_layout_options_meta_box', 'programa', 'normal');
	remove_meta_box('generate_layout_options_meta_box', 'post', 'normal');
  }
}

Thanks anyway :)
Regards

Perfect :) Thanks for the sharing the full code!

This archived topic is closed to new replies.