How to add_filter/action to comment out CSS generated by admin function?

So in wp-includes/admin-bar.php there is a function that adds CSS styling to the page:

    function _admin_bar_bump_cb() { ?>
    <style type="text/css" media="screen">
        html { margin-top: 28px !important; }
        * html body { margin-top: 28px !important; }
    </style>
    <?php
    }

I want to comment this out properly (either the function or the contents of the function, either one is fine) but not touch the core code. How would I do this?

Related posts

1 comment

  1. I think you can do it like this:

    function my_admin_bar_init() {
        remove_action('wp_head', '_admin_bar_bump_cb');
    }
    add_action('admin_bar_init', 'my_admin_bar_init');
    

    Add this to your functions.php file. It will disable outputting of these inline styles in <head> section but the wp_admin_bar will be still available.

    If you would like to disable wp_admin_bar entirely, you can do it like this:

    remove_action( 'wp_footer', 'wp_admin_bar_render', 1000 );
    

Comments are closed.