0

I am using latest version of All In One Seo Package.

How can I remove metaboxes from posts for User Role: "Contributors"?

0

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.

  • Unfortunately above code didn't work. I login in Dashboard and try to create a post as Contributor and All in One Seo Pack metabox is inside post. Any suggestion? Thank You! – Naser Oct 10 '15 at 15:17
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.