Remove WordPress Toolbar buttons

Is there anyway to remove the ‘W’ icon from the WordPress toolbar located at the top, when Authors login?

I know that an author can uncheck an option for an individual user, but we need to do this for all users?

Related posts

Leave a Reply

4 comments

  1. function mytheme_admin_bar_render() {
      global $wp_admin_bar;
      $wp_admin_bar->remove_menu('wp-logo');
    }
    add_action( 'wp_before_admin_bar_render', 'mytheme_admin_bar_render' );
    

    For specific user roles you can wrap the add_action in a conditional, something like

    if(current_user_can('editor')){
     add_action( 'wp_before_admin_bar_render', 'mytheme_admin_bar_render' );
    }
    

    http://codex.wordpress.org/Roles_and_Capabilities

  2. you can use jQuery

    $('#wp-admin-bar-wp-logo').remove(); //this will remove only WP logo
    

    Also this will remove the whole top menu bar for everyone but the admin (user 1). This will update the user meta to hide the menubar. The user will still be able to select to show or hide this but will be reset to hide. You can also hide this option from the use with jQuery.

    Place this in the functions.php file

    if (!current_user_can('administrator') || get_current_user_id() != 1)
    {
        $user_id = get_current_user_id();
        update_user_meta( $user_id, 'show_admin_bar_front', false );
        update_user_meta( $user_id, 'show_admin_bar_admin', false );
    }