Hide Toolbar Unless Admin

Sometimes you want to hide the WordPress toolbar unless the logged in user is an admin. This is especially helpful when using a plugin like Restrict Content Pro┬ábecause when a new user signs up they’ll see the toolbar, which isn’t a great look for your brand.

function remove_toolbar_bar_unless_admin() {
if (!current_user_can('administrator') && !is_admin()) {
add_action('after_setup_theme', 'remove_toolbar_bar_unless_admin');


Comments are closed for this post.


Inspirational Newsletter

Join the newsletter to get the best articles, tutorials and exclusive freebies every two weeks.

No spam. You can unsubscribe at any time.