Skip to:

Admin bar load in Header instead of Footer?

  • Is there a way to get the Admin Bar (or whatever its name is this month) to load in the header as apposed to the footer so you don’t have the load delay?

    I know this is more of a WP question, but I thought I would ask the experts here anyway. :)


Viewing 10 replies - 1 through 10 (of 10 total)
  • If it loaded first, you’re going to get other elements of your page loading last — and they might be a more essential element of your page than the toolbar. I’d more investigate ways of speeding up the loading time on your site.

    We have made lots of mods to it, so it may be more critical to us than on other sites. I understand why it’s in the footer and that may be best for most, but we have incorporated it into the header unlike the default usage. We could hard code it but I though there may be a way to do it within the functions.

    There seems to be very little about the toolbar WP core functions the codex. It’s very hard to Google, so if anyone can point me in the right direction I would be very thankful. :)

    Does anyone know where in the WP core the function that inserts it into the footer is?


    I completely understand why this was originally inserted into the footer. Originally this bar was just a feature for admins. Now that BP and others have turned it into a site feature this load last logic no longer applies. Furthermore, it doesn’t matter how “lite” you make your theme. If you have media embeds, images, like buttons, etc. in your page content you will see a noticeable delay, that depending on theme could make it appear broken. If it is going to be used as a site element it should be treated as such.

    Moreover, there seems to be a growing attitude at WP that making themes idiot proof is more important than developer control. Don’t get me started on Post Formats. This goes as far as ignoring customization questions that may conflict with any pseudo coding philosophy they cling to. There is nothing wrong with breaking the rules as long as you know what they are.

    Sorry wasn’t trying to turn this into a rant, I just have strong feelings about that stuff.

    Another issue I just discovered is when you use Lazy Load js it doesn’t load the avatars until you reach the footer.



    in wp 3.4.x
    wp-includes/class-wp-admin-bar.php ( loads into header)

    @chouf1 THANK YOU!

    That was all I needed. In retrospect I should have looked there. :P

    Here is what you add to the functions.php if anyone else is interested….

    `remove_action( ‘wp_footer’, ‘wp_admin_bar_render’, 1000 );
    remove_action( ‘admin_footer’, ‘wp_admin_bar_render’, 1000 );
    add_action( ‘wp_head’, ‘wp_admin_bar_render’, 1000 );
    add_action( ‘admin_head’, ‘wp_admin_bar_render’, 1000 );`

    Jacob Schweitzer


    Excellent, this is just what I was looking for. Pages appear to load much more naturally to the user now this way. Thanks @FIQ and @chouf1 !



    Thank you for this information, exactly what I was looking for. I am receiving an error in the firebug console when I have the following code in my theme’s functions.php file:

    remove_action( ‘wp_footer’, ‘wp_admin_bar_render’, 1000 );
    remove_action( ‘admin_footer’, ‘wp_admin_bar_render’, 1000 );
    add_action( ‘wp_head’, ‘wp_admin_bar_render’, 1000 );
    add_action( ‘admin_head’, ‘wp_admin_bar_render’, 1000 );

    I have that at the very top of the functions.php just under the “if ( !defined( ‘ABSPATH’ ) ) exit;” statement.

    The error that I receive in the console is:
    `TypeError: b is null
    b[c][/c] = b[c][/c].replace( rcs, ‘ ‘ );`

    That references the following javascript:
    (function() {
    var request, b = document.body, c = ‘className’, cs = ‘customize-support’, rcs = new RegExp(‘(^|\\s+)(no-)?’+cs+'(\\s+|$)’);

    request = true;

    b[c][/c] = b[c][/c].replace( rcs, ‘ ‘ );
    b[c][/c] += ( window.postMessage && request ? ‘ ‘ : ‘ no-‘ ) + cs;

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Admin bar load in Header instead of Footer?’ is closed to new replies.
Skip to toolbar