Wordpress admin bar not showing on frontend

Some custom wordpress theme doesn't show the admin bar into the theme page same with the wp_head() and the wp_footer() wrote on the templates files. To resolve that problem just add the following code into your function.php or into your own plugin:

function admin_bar(){

  if(is_user_logged_in()){
    add_filter( 'show_admin_bar', '__return_true' , 1000 );
  }
}
add_action('init', 'admin_bar' );

Hope that help...


I have managed to make it appear again by adding

<?php wp_footer(); ?>

in "header.php" after </header> tag.

One important thing is to clear cache (check if you have cache plugin for Wordpress installed like WP Super Cache or LiteSpeed Cache..) and then CTRL + F5 to refresh page.


If you had the bar showing previously, you might try this super-easy fix (worked for me):

  1. Go to your profile in WP Admin
  2. Check to see if "Show Toolbar when viewing site" is checked
  3. If not, select this and save … that should fix it
  4. If the option IS checked, deselect it and save. Then, select it again and save.

Now have another look at the frontend. I did this and it fixed whatever the issue was without messing with any of the files.

Tags:

Wordpress