2

I want to remove how it adds 32px to the top of the HTML tag. It's dumping it there with a STYLE tag right at the end with !important.

It's damn impossible to override it, because there are no hooks or HTML and wordpress is setting it with like 5 css rules :/

2 Answers 2

4

What you are seeing is probably produced by _admin_bar_bump_cb().

From quick look at code it includes following instructions inline in WP_Admin_Bar class:

To remove the default padding styles from WordPress for the Toolbar, use the following code:

add_theme_support( 'admin-bar', array( 'callback' => '__return_false' ) );

1

Check out David Walsh's solution:

add_action('get_header', 'remove_admin_login_header');
function remove_admin_login_header() {
    remove_action('wp_head', '_admin_bar_bump_cb');
}

https://davidwalsh.name/remove-wordpress-admin-bar-css

This way you can still show the admin bar, but implement your own CSS!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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