Remove top admin bar

whenever admin or any other user logs in a top bar menu ads up. Now I made login for everybody, so I do not want this bar.

First I added display:none to admin-bar.css, but the main problem is that wordpress is still adding a white line on the top with:

html {
    margin-top: 28px !important;

How to remove this as this is causing some design flaws.

8 s

Has an article about it.

But basically

/* Disable the Admin Bar. */
add_filter( 'show_admin_bar', '__return_false' );

or also

remove_action('init', 'wp_admin_bar_init');

I believe in your functions.php will disable it. Probably a better way than just hiding it thriough css

THe reason you still get the gap with the menu hidden is because WP adds this css as well

html { margin-top: 28px !important; }
* html body { margin-top: 28px !important; }

So a margin is added up top…. you could negate that css in yours, but just disabling the bar is probably better if that’s what you want to do

Leave a Comment