WordPress 3.1 Admin Bar Upgrade Issues

Well, WordPress 3.1 has been out in the wild for hours now.  I’m seeing the support requests trickle in, and there is already a very common issue.  A strange white gap at the top of the page where the admin bar should be.  Let’s fix that, or conversely, if you have the admin bar and hate it, let’s get rid of it!

First up, the mysterious missing admin bar, leaving just a gap at the top of your page.  Now remember, the admin bar only shows when you are logged in.  But if you are logged in and just see a blank space with no admin bar, chances are you are missing your wp_footer call.  Simple fix, add it in footer.php on the line above your closing body tag, so your footer.php should end like:

          <?php wp_footer(); ?>
     </body>
</html>

On the flip side of this problem is the wp_head call. This may surprise you, but that one goes up in your header.php file! Take a look, it should be right before the closing heade tag, or real close. It may not be at the very bottom of your header.php file itself, as often there is body content in your header. Your header image, your navigation, etc. But somewhere in your header.php file you should see:

<?php wp_head(); ?>
</head>

I’m amazed this is affecting so many people. That wp_footer and wp_head calls are vital for so many things. Anyway, get that in there and you should be all set. Now what if you hate the admin bar. Well for one, you can set it up in your user profile page. Turning it on or off for the front or back end. Or you can drop this into functions.php to kill it altogether:

//REMOVE ADMIN BAR
remove_action('init', 'wp_admin_bar_init');

I’ve also seen this code for removing the admin bar (I trust the author of this solution, so I’d try this one first):

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

Either way it gets added to functions.php. (or mu-plugins for site wide on multisite, you’ll remember that from this article)

And there you have it. 2 Admin Bar problems resolved! If you have other problems with the admin bar, or found this topic looking for general problems with a 3.1 upgrade, please check out this link on the forums. It’s a master list being kept of problems and solutions.

Leave a Reply

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