最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

Hide admin tool bar from back end dashboard

matteradmin9PV0评论
This question already has answers here: Removing admin bar from wordpress dashboard (4 answers) Closed 6 years ago.

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

This question already has answers here: Removing admin bar from wordpress dashboard (4 answers) Closed 6 years ago.

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

Share Improve this question edited Mar 8, 2019 at 19:52 fuxia 107k39 gold badges255 silver badges461 bronze badges asked Mar 8, 2019 at 19:10 user3022041user3022041 232 bronze badges 0
Add a comment  | 

2 Answers 2

Reset to default 1

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;
        }
    </style>
<?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;
    $wp_admin_bar->remove_menu('comments');
    // Code to remove other items goes here
    ....
    ....
}
add_action( 'wp_before_admin_bar_render', 'my_admin_bar_render' );

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/blog/disable-wordpress-admin-bar/

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far