is_admin_bar_showing

Determine whether the admin bar should be showing.

Description

is_admin_bar_showing(); 

Usage

  1. if ( !function_exists( 'is_admin_bar_showing' ) ) { 
  2. require_once ABSPATH . WPINC . '/admin-bar.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = is_admin_bar_showing(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/admin-bar.php  
  1. function is_admin_bar_showing() { 
  2. global $show_admin_bar, $pagenow; 
  3.  
  4. // For all these types of requests, we never want an admin bar. 
  5. if ( defined('XMLRPC_REQUEST') || defined('DOING_AJAX') || defined('IFRAME_REQUEST') ) 
  6. return false; 
  7.  
  8. if ( is_embed() ) { 
  9. return false; 
  10.  
  11. // Integrated into the admin. 
  12. if ( is_admin() ) 
  13. return true; 
  14.  
  15. if ( ! isset( $show_admin_bar ) ) { 
  16. if ( ! is_user_logged_in() || 'wp-login.php' == $pagenow ) { 
  17. $show_admin_bar = false; 
  18. } else { 
  19. $show_admin_bar = _get_admin_bar_pref(); 
  20.  
  21. /** 
  22. * Filters whether to show the admin bar. 
  23. * Returning false to this hook is the recommended way to hide the admin bar. 
  24. * The user's display preference is used for logged in users. 
  25. * @since 3.1.0 
  26. * @param bool $show_admin_bar Whether the admin bar should be shown. Default false. 
  27. */ 
  28. $show_admin_bar = apply_filters( 'show_admin_bar', $show_admin_bar ); 
  29.  
  30. return $show_admin_bar;