Disable WordPress Admin Bar

Sometimes we need to remove the admin bar from the top from front end users when creating a membership website using wordpress.So here we are discussing about how we can disable wordpress admin bar or Hide WordPress admin bar

So copy the below code to the theme’s functions.php

add_action('after_setup_theme', 'remove_admin_bar');

function remove_admin_bar() {
if (!current_user_can('administrator') && !is_admin()) {
  show_admin_bar(false);
}
}

This code snippet will remove the admin bar from the users who doesn’t have administrator privilege

And if we need to remove the admin bar from all users use this code below

show_admin_bar(false);

So this post will help you to disable wordpress admin bar

One Comment on “Disable WordPress Admin Bar

  1. Darmowe strony internetowe
    January 3, 2014

    Excellent Blog!|
    These are truly enormous ideas in on the topic of blogging. You have touched some fastidious factors here.

Leave a Reply

Your email address will not be published.