Possible Duplicate:
WordPress SEO by Yoast: Hide Meta boxes in posts for non-admins

I was wondering how to remove Meta-boxes from the post page. I would like that only administrators or editors could see these. I saw similar topics on the forum, but none of them appears to be working. Any suggestions?


1 Answer 1


See WordPress SEO by Yoast: Hide Meta boxes in posts for non-admins

add_action('add_meta_boxes', 'yoast_is_toast', 99);
function yoast_is_toast(){
    //capability of 'manage_plugins' equals admin, therefore if NOT administrator
    //hide the meta box from all other roles on the following 'post_type' 
    //such as post, page, custom_post_type, etc
    if (!current_user_can('activate_plugins')) {
        remove_meta_box('wpseo_meta', 'post_type', 'normal');
  • Should I replace code in Line 32: add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) ); with this?
    – user23076
    Commented Oct 30, 2012 at 16:59
  • 1
    No... you need to only add the function snippet above to your functions.php file, nothing else, except change post_type to your required type i.e. post. The references to line numbers in the other answer only explain whats in the plugin file itself for reference on where I sourced further information. Normally you would just get the name of the metabox from the ID parameter on the edit screen. I didnt have yoast installed at time, so I just dug into plugin files
    – Adam
    Commented Oct 30, 2012 at 17:00

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