Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Steve M

    (@wpsmort)

    There are some plugins that do this such as https://wordpress.org/plugins/im8-box-hide/ or if you’re comfortable with PHP you could write a function using remove_meta_box() to do this – https://codex.wordpress.org/Function_Reference/remove_meta_box

    Thread Starter NSRS

    (@nsrs)

    Hello,

    I am not interested to install and an other plugin for Page Speed reasons!

    I have install User Role but unfortunately not any customisations for All in One Seo.

    I have also try these Snippets without any result :

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

    And this :

    function remove_my_post_metaboxes() {
    	if ( current_user_can('contributor') ) {
    		remove_meta_box( 'aiosp','post','normal' ); // AIOSP Metabox
    	}
    }
    add_action('admin_menu','remove_my_post_metaboxes');

    None of the above works!

    Any suggestion?

    Please Help!

    Hey NSRS,
    have you succeeded? I’m trying to do the same thing but with no success at all. here is my code:

    if (is_admin()) :
    function itamar_remove_meta_boxes__admin() {
    	if (!current_user_can( 'manage_options' )) { //if user is not admin
    		remove_meta_box( 'aiosp', 'post', 'advanced' ); //hide All In One SEO meta box in posts
    		remove_meta_box( 'aiosp', 'pages', 'advanced' ); //hide All In One SEO meta box in pages
    	}
    }
    add_action( 'admin_menu', 'itamar_remove_meta_boxes__admin' );
    endif;

    Thanks,
    Itamar

    Michael Torbert

    (@hallsofmontezuma)

    WordPress Virtuoso

    Try the add_meta_boxes action.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Remove All in One Seo from Posts for Contributors’ is closed to new replies.