How to Show WordPress Admin Bar 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' );

This code was posted by Chen-Tsu Lin in the StackOverflow forum thread.
Read the complete thread post to better understand about how to show WordPress Admin Bar in Frontend.

Leave a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

error: Content is protected !!