How to remove html { margin-top: 28px !important; } from wordpress header

To remove html { margin-top: 28px !important; } from wordpress header go to /wp-includes/admin-bar.php and edit around line 672 (in WordPress 3.3)

Alternatly you can add a remove_action filter in you active theme/functions.php file like this, as this is a part of _admin_bar_bump_cb function which is defined in above mentioned file:

add_action('get_header', 'my_filter_head');

function my_filter_head() {
	remove_action('wp_head', '_admin_bar_bump_cb');
}

You can check detailed discussion here, http://wordpress.org/support/topic/31-update-causing-28px-top-spacing-in-html-body

10 thoughts on “How to remove html { margin-top: 28px !important; } from wordpress header

  1. More Easy way:- open wp-includes folder there is a file name admin-bar.php open it in editor and search your margin like 28px or 32px; remove this space where you get this. It will work f9 for you.

    1. My dear Suraj, you should not touch core files as they are subject to be updated automatically :)

      As mentioned in another comment (here by Wellen) this space is due to the fact that you have had a logon using admin details and for some reason (js or css) glitch the admin bar failed to load. So once you have that issue fixed you wont need to fix this margin at all. I hope that makes sense.

Leave a Reply

Your email address will not be published. Required fields are marked *