How do we hide the admin toolbar from the back end dashboard?

We can hide the toolbar when viewing the website with the below code but we want to also hide it from back end?

add_filter('show_admin_bar', '__return_false');

Thank you


WordPress page for show_admin_bar says:

You cannot turn off the toolbar on the WordPress dashboard

However, this trick works

    function remove_admin_bar() { ?>
    <style type="text/css">
        body {
            margin-top: -28px;

        body.admin-bar #wphead {
            padding-top: 0;

        #wpadminbar {
            display: none;
<?php }

add_action( 'admin_head', 'remove_admin_bar' );

In oreder to remove certain menus from admin bar use $wp_admin_bar->remove_menu($id); where $id of a specific menu can be found in Chrome Dev Tool. Each menus' <li> id in Dev tool is in the form of wp-admin-bar-{id}, for example Comments menu has id wp-admin-bar-comments. So to remove this menu code should be like this,

// remove links/menus from the admin bar
function my_admin_bar_render() {
    global $wp_admin_bar;
    // Code to remove other items goes here
add_action( 'wp_before_admin_bar_render', 'my_admin_bar_render' );
| improve this answer | |
  • Hi Qaisar Feroz, this works but then we cant log out, is there anyway to hide everything and just just keep the login user settings with the logout link? Thank you – user3022041 Mar 10 '19 at 10:01
  • Answer updated, see the last code block as a guide. – Qaisar Feroz Mar 10 '19 at 14:57

Turn Off the Admin Toolbar in Settings. Disable the admin toolbar in your profile settings. To remove the toolbar from your site, go to Users > Your Profile. Scroll down to “Toolbar” and check “Show Toolbar when viewing site.

Reference : https://www.machothemes.com/blog/disable-wordpress-admin-bar/

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.