WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Yoasts SEO plugin adds a metabox to the post edit screen. I'm trying to remove this for users who aren't editors or above.

I've tried putting a remove_meta_box call in on admin_init, trying to remove the action on $wpseo_metabox but to no avail.

How do I remove this metabox without requiring user intervention (the user should never know the metabox existed, so clicking on screen options is not an option )

share|improve this question

closed as off-topic by Johannes Pille, Pieter Goosen, gmazzap, birgire, cybmeta Nov 14 '14 at 9:17

This question appears to be off-topic. The users who voted to close gave these specific reasons:

If this question can be reworded to fit the rules in the help center, please edit the question.

Dare I ask why you want to remove it? Is there anything specifically you don't want them to be able to do? – Joost de Valk Aug 22 '12 at 7:29
Because there's a class of user who has no idea what SEO is, things need to be simplified for them ( more to the point the client with the cash requested it ). Someone with editor level privs will be moderating and approving the post anyway so it's better if they do the SEO part rather than the bottom level users writing the initial content. – Tom J Nowell Aug 22 '12 at 8:59
And this should really be a comment not an answer, wouldn't want other people to downvote you – Tom J Nowell Aug 22 '12 at 9:01
up vote 11 down vote accepted

On remove_meta_box is a note:

Because you can't remove a meta box until it's been added, it's important to make sure your call to remove_meta_box() happens in the right sequence.

WordPress SEO adds meta boxes on add_meta_boxes action with default priority - 10, which run after admin_init, so that won't remove them. Instead you need to hook into add_meta_boxes, but with lower priority - 11, 12, etc.

function mamaduka_remove_metabox() {
    if ( ! current_user_can( 'edit_others_posts' ) )
        remove_meta_box( 'wpseo_meta', 'post', 'normal' );
add_action( 'add_meta_boxes', 'mamaduka_remove_metabox', 11 );
share|improve this answer
This does the job =] Thanks @Mamaduka – Tom J Nowell Aug 22 '12 at 9:44

Remove metaboxes for non-admin accounts:

add_filter ( 'manage_edit-post_columns', 'rkv_remove_columns' );
function rkv_remove_columns( $columns ) {

   if ( ! current_user_can('administrator') ) { 

    unset( $columns['wpseo-score'] );
    unset( $columns['wpseo-title'] );
    unset( $columns['wpseo-metadesc'] );
    unset( $columns['wpseo-focuskw'] );
    return $columns;
share|improve this answer

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