5

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?

7
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

  • Sorry, noob question but where do I add this? – AshesToAshes Apr 2 '12 at 17:07
  • add this to your theme's functions.php, or make a plugin with it so it can work on any theme. – Wyck Apr 2 '12 at 17:10
  • Excellent thats worked fabulously! :) – AshesToAshes Apr 2 '12 at 17:12
0

To just remove the logo from the toolbar, add this to your stylesheet:

#wp-admin-bar-wp-logo { display:none; }
  • ohh excellent ... would I edit the Style.css from the Twenty Eleven theme? – AshesToAshes Apr 2 '12 at 17:05
0

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 );
}
  • is there anyway to keep it there but just have the 'New' button? – AshesToAshes Apr 2 '12 at 17:14
  • 1
    I think @Wyck has the best answer. – Nick Apr 2 '12 at 17:16
  • Add additional $wp_admin_bar->remove_menu('whatever'); . Replace whatever with the end of the id of the element you want to remove. example - remove comment wp-admin-bar-comments is the id of the element to remove. Replace whatever with just comments. Remove the wp-admin-bar-. – Nick Apr 2 '12 at 17:24
0

Also you can use plugin Toolbar menu. You can:

  • Use custom menu to show in Toolbar
  • Deactivate default WordPress Toolbar sections
  • Show Toolbar to guest users
  • Show login box in Toolbar for guest users

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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