How to disable WordPress admin bar from front end without plugin

disable admin bar from front end without plugin

Most website owners want to remove the admin bar from the front-end when users login to your wordpress website. You can do it by the plugin but Most people don’t like to use the plugin. So if you use this code you can do it easily in wordpress. It is the most common way to disable the wordpress admin bar from the front-end. You can disable the admin bar Admin Bar Disabler plugin.

So Let start Now

Just put the below code in the function.php 

Remove admin bar from all users.

<?php
/* Wordpres admin bar remove */
show_admin_bar( false );
?>

if you want just to keep the admin bar for administrator then just put the below code.

Remove Admin Bar for All Users Except for Administrators

add_action('after_setup_theme', 'admin_bar_remove');
 
function admin_bar_remove() {
if (!current_user_can('administrator') && !is_admin()) {
  show_admin_bar(false);
}
}

Thank you. if you have any questions type in the comment box.

 

NordVPN Free Premium Licence key 2019 | 100% Working

Leave a Reply

Your email address will not be published. Required fields are marked *

Press ESC to close