Hide admin bar for non admins in WordPress

Paste this snippet in your theme’s functions.php file to hide admin bar for all users except admin.

add_action('after_setup_theme', 'hide_admin_bar');
function hide_admin_bar() {
if (!current_user_can('administrator') && !is_admin()) {
Need a helping hand in fixing your website issues?

If you are facing any problems in implementing these code snippets and tutorials, you can hire us to fix your website issues.

Hire Us