WP Admin Toolbar Missing When Viewing Site

I’ve had this problem quite a few times and always forget how to fix it so I am just jotting this down for my future reference and if it helps you, all the better.

The solution that worked for me in this case

In short, I logged out then logged back in and the WP admin bar showed up again.

Below, I have listed the chain of events, including everything I did and learned about this thing.

This is how the problem presented itself.

  1. I built a wordpress site in its own directory (example.com/wp) and while I worked on it, I kept the Site URL the same as the WordPress URL so it would not be visible from the root directory until it was approved to go live.
  2. Once the site was approved to go live, I
    • changed the Site URL to now point to the root directory.
    • I made a copy of the .htaccess file  and the index.php file in the /wp directory and placed them in the root directory
    • I altered the following code in the index.php file:
      require( dirname( __FILE__ ) . '/wp-blog-header.php' );
      require( dirname( __FILE__ ) . '/wp/wp-blog-header.php' );

My long, rushed, strange, sometimes illogical path to a solution

Of course I didn’t think to log out and log back in again. I was still automatically logged in and everything worked except the toolbar was not displaying.

Google search. “wp thing not showing up” I impatiently wrote. What was this thing even called? I mean, tool bar, right? Use your brain. But my brain no work this day. After awhile of typing in all the wrong words I decided to get the chrome inspector onto it. Right click on tool bar > Inspect .. element=”wpaminbar” – now I had a name for the thing!

Google search: wpadminbar not showing. WordPress forums, blogs, four ways to fix, stack overflow. Lots of info, solutions etc.

For my future convenience (and yours), I have gathered all the possible solutions I could find

After trying each of these make sure you refresh to check if it worked.

  1. First, start with logging out then logging back in
  2. In WP admin dashboard: go to Users > Your Profile > Show Toolbar when viewing site. Make sure the option is checked.
  3. in header.php – if it’s not already there, add <?php wp_head(); right before </head>
  4. (this seems to be the most common solution) In footer.php – if it’s not already there, add <?php wp_footer(); right before </body>
  5. In functions.php – add:
    add_filter('show_admin_bar', '__return_false');
  6. Disable all plugins. Refresh site. If the admin bar shows, through a process of elimination re-enable each plugin one by one until the bar stops showing again. That plugin is your culprit.
  7. Revert to Default theme. Refresh. If the admin bar shows up – your theme is the culprit.
  8. Delete cookies.
  9. From Four Ways to Fix:

    If you’ve done all of the above & the WordPress admin bar is still not showing up … Check for CSS/HTML conflicts…

    1. The WordPress admin bar uses a class ID of #wpadminbar – make sure you’re not overwriting those styles.
    2. <ul> and <li> – the WP admin top bar uses <ul>’s and <li>’s — be sure you’re not overwriting the styles that make them show.
    3. Check your source code and search for “wpadminbar” – make sure the thing is actually showing up!
    4. Upgrade your WordPress installation: It wasn’t until version 3.something that the WordPress admin bar was introduced.. if you’re not up to date, you’re not going to have this feature.

If you think of anything else, let me know and I will add it.

The question that came out of all this

Me 1: Is there a place that compiles all the solutions for all questions based on what the internet says?

Me 2: Yes, it’s called a search engine.  And drop that idea immediately! By trying to make things simpler you are only creating more chaos.

Me 1: Oh, I know I’m trapped down an organisational systems rabbit hole but I can’t seem to stop going further and further into it.

Me 2: This is a pointless post.

Me 1: No. It will help me!

Me 2: No. You’ll never come back here let alone post anything else on this blog. You’ve tried blogging before, remember.  Trust me, it’s better this way.

Me 1: I’m hungry.

Me 2: Me too.