If you were making changes to the WordPress site theme and the admin bar (also known as a toolbar) on a live site disappeared, you are not alone. This happened to me too. I noticed that the admin bar at the top of the page was missing on the front end after making some updates on my theme. The admin panel was still accessible through
/wp-admin/ path and inside the dashboard, the admin bar was not broken. In this post I will show you why this happens and how to bring it back.
This is how that admin bar appeared on my site. It completely disappeared with empty space in its place.
Missing Admin Bar at the top of the page
First, I tried to identify what exactly caused this problem. I suspected it had to do with my recent template modifications so I temporarily switched to different theme to see what happens. And sure thing the admin bar was not blank and worked perfectly on that template.
Here are the possible causes of the problem:
Admin bar / Toolbar is disabled for the user
Let’s tackle the easiest one first. One possibility is that the admin bar (known in WordPress as Toolbar) is turned off in your user profile.
Go to Dashboard > Users > Your Profile and under Toolbar option, “Show Toolbar when viewing site” should be checked as shown below:
If the Toolbar is selected, then there is something wrong in your template files. The solutions below will require template modification by going to Dashboard > Appearance > Editor.
Admin bar is turned off in functions.php
This one can also be easily checked. Open functions.php and look for either show_admin_bar function or show_admin_bar filter. The false parameter will disable admin bar.
For example, free WordPress theme HTML5 Blank does exactly that with the following code inside
// Remove Admin bar
add_filter('show_admin_bar', 'remove_admin_bar'); // Remove Admin bar
Commenting off those lines of code solves the problem.
Missing wp_footer function
Before the ending </body> tag, a call to the wp_footer function should be made. So find the templates with </body> tag and check if wp_footer function is present. Usually the only template to check for this is the footer template
footer.php, but this is not always the case. Some template files might have their own </body> tag and they should also contain wp_footer function before that tag. The code should look something like this:
<?php wp_footer(); ?>
can also break plugins, so if some plugins are also not working correctly, this might be the cause.
Missing get_footer function
If you found wp_footer() before </body> tag inside
footer.php, then maybe the template files do not render the footer at all. The footer is rendered when a call to get_footer function is made. Since a lot of template files call footer, try to determine, which template is causing the problem. For example, if the admin bar is missing in pages, but not in posts, look into a page template
page.php, if the problem is with posts, inspect
single.php. If you are not familiar with the WordPress templates, check WordPress Template Hierarchy for more information.
When the problematic template is located, look at the end of the file as this is where call to the footer should be made:
Not all template files need get_footer()
. For example,
is shown, when other templates call get_sidebar()
. In that case, the
shouldn’t have get_footer
at the end of the template.
PHP Syntax Error
If you located both the get_footer() and wp_footer() functions, then there is a possibility that the code execution stopped due to some PHP syntax error and it never reached either of the functions. Turning on debugging can help you identify the problem. Locate the following line inside
wp-config.php file and set it to true.
Important: Do not forget to turn off debugging by setting it back to false when you are done!!!!
Instead of turning on debugging, you can alternatively check for PHP errors by temporarily putting echo statements inside templates to test where the execution of the code stops.
Culprit of my problems was the last case. There have been PHP errors just before the get_footer call, so the whole template was generated, but the last few lines of code were never executed.
When we customize our template files, missing admin bar / toolbar in WordPress might occur due to various reasons. In this article, we listed five of them, the most common are when call to either wp_footer or get_footer is missing in the template(s).
I hope this post will help others in similar situations. If you are aware of some other way that causes this problem, let me know and I will add it to the list.
This article was first published in 2013 and has been updated and republished.