I am using latest version of All In One Seo Package.
How can I remove metaboxes from posts for User Role: "Contributors"?
I am using latest version of All In One Seo Package.
How can I remove metaboxes from posts for User Role: "Contributors"?
This effectively removes metaboxes IF the current user is a contributor. This does not remove any admin column data ( like SEO Description and such when viewing pages ). You need to define which post types to run it on in the $post_types
array which will then loop through and target specifically the aiosp
metabox ( that's the metabox ID ) and removes it.
function wpse_205080() {
if( current_user_can( 'contributor' ) ) {
$post_types = array( 'page', 'post' );
foreach( $post_types as $type ) {
remove_meta_box( 'aiosp', $type, 'normal' );
}
}
}
add_action( 'do_meta_boxes', 'wpse_205080' );
There's a ton of questions regarding removing metaboxes if you search through the site. The big thing is taking advantage of your browser's Developer Tools to find the ID.
There is a post on the WordPress.org forum for All in One SEO Pack for WordPress about this very subject. You may want to use a role manager plugin to assist with this and manage that users role.