Site logo

Archived topic

hide "Disable Elements" and "Sidebars" by user role with a hook

6 replies · Started by Oriol on May 7, 2020

Viewing posts 1–7 of 7

hi,
I would like to hide to editors the ability to change page structure (use sections, sidebars and layout), in the settings of page/post editor.

how can i do that
with a hook?

thanks

Hi Leo,
thanks, I try it

Let me know :)

have a question with this. while this code works to prevent the editor user role from using page edit gp meta boxes:

function limit_gp_metaboxes($cap){
	if(current_user_can('editor')) return false;
	return $cap;
}
add_filter("generate_metabox_capability","limit_gp_metaboxes");

the same user is still able to modify gp meta boxes in elements blocks. is there another hook?

found out this will do the trick:

function remove_elements_metabox() {
	if(current_user_can('editor')) {
		remove_meta_box('generate_premium_elements', 'gp_elements', 'normal');
	}
}
add_action( 'add_meta_boxes', 'remove_elements_metabox', 999 );

Glad to hear you found the solution

This archived topic is closed to new replies.