how to hide top bar button on wp-adminedit.php

admin2025-01-07  3

On the page /wp-admin/edit.php there is some buttons on the top bar "website name" "add" and "show post" i want to hide these buttons completely. How would i go about doing that?

On the page /wp-admin/edit.php there is some buttons on the top bar "website name" "add" and "show post" i want to hide these buttons completely. How would i go about doing that?

Share Improve this question edited Jun 1, 2019 at 15:56 fuxia 107k38 gold badges255 silver badges459 bronze badges asked Jun 1, 2019 at 12:40 christopherchristopher 1 1
  • Those do not look like standard WordPress controls. Do you have a page builder of some kind installed? – Jacob Peattie Commented Jun 1, 2019 at 13:02
Add a comment  | 

1 Answer 1

Reset to default 0

So a straight forward way to do this is to use CSS if you want to pick out a few items to not display on the admin. These items you've provided look like the standard menu items with a different style attached, though I can't be sure. If not, you'll need to provide more clearer info

For example, the CSS to use to hide the 'name', 'add', and 'show post' links, is:

#wp-admin-bar-site-name,
#wp-admin-bar-view,
#wp-admin-bar-new-content {
    display: none;
}

There would probably more involved ways to achieve with code snippets, but you can try this for now.

If you don't have a way currently for easily customizing your WP Admin CSS styles, you can simply copy-paste this code below and put it straight into your theme's functions.php file.

        add_action( 'admin_print_styles', function () {
            echo '<style>
                #wp-admin-bar-site-name,
                #wp-admin-bar-view,
                #wp-admin-bar-new-content {
                    display: none;
                }
            </style>';
        } );

Each of the lines that begins with wp-admin-bar- represents the ID of an HTML element on the page. To hide other elements you need their IDs. And to get their IDs, you can use your browser's inspect functionality, find the ID, and create a new line in the code for your extra ID.

I've attached a little screenshot that makes this obvious how to do it.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736257782a464.html

最新回复(0)