Remove the Yoast SEO Post Metabox [closed]

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 );

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)