#1663
Vladimir
Keymaster

Code below removes all metaboxes from the post editor page for all users with “editor” role. Modify it for your own needs. Revisions metabox is ‘revisionsdiv’.


add_action('add_meta_boxes', 'remove_post_metaboxes', 11);

function remove_post_metaboxes() {
if (!current_user_can('editor')) {
return;
}

$side_metaboxes = array('formatdiv', 'categorydiv', 'tagsdiv-post_tag', 'postimagediv');
$normal_metaboxes = array('revisionsdiv', 'postexcerpt', 'trackbacksdiv', 'postcustom', 'commentstatusdiv', 'commentsdiv', 'slugdiv', 'authordiv');

foreach($side_metaboxes as $metabox) {
remove_meta_box($metabox, 'post', 'side');
}
foreach($normal_metaboxes as $metabox) {
remove_meta_box($metabox, 'post', 'normal');
}

}

add_action('add_meta_boxes', 'remove_page_metaboxes', 11);