Disable toolbar for Users
This script disables the WordPress toolbar for all users except admin. In order to set this for other user roles, change line 5 to your liking.
Add to functions.php file or plugin.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | // disable the toolbar except for admin add_action('init', 'remove_admin_bar'); function remove_admin_bar() { if (is_user_logged_in() && !current_user_can('administrator') && !is_admin()) { add_filter( 'show_admin_bar', '__return_false' ); remove_action( 'personal_options', '_admin_bar_preferences' ); echo '<style type="text/css"> #wpadminbar { position:relative; display:none; } body { margin-top:-28px !important; } </style>'; } } |