is_admin_bar_showing

The timeline below displays how wordpress function is_admin_bar_showing has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.1

/**
 * Determines whether the admin bar should be showing.
 *
 * For more information on this and similar theme functions, check out
 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
 * Conditional Tags} article in the Theme Developer Handbook.
 *
 * @since 3.1.0
 *
 * @global bool   $show_admin_bar
 * @global string $pagenow        The filename of the current screen.
 *
 * @return bool Whether the admin bar should be showing.
 */
function is_admin_bar_showing()
{
    global $show_admin_bar, $pagenow;
    // For all these types of requests, we never want an admin bar.
    if (defined('XMLRPC_REQUEST') || defined('DOING_AJAX') || defined('IFRAME_REQUEST') || wp_is_json_request()) {
        return false;
    }
    if (is_embed()) {
        return false;
    }
    // Integrated into the admin.
    if (is_admin()) {
        return true;
    }
    if (!isset($show_admin_bar)) {
        if (!is_user_logged_in() || 'wp-login.php' === $pagenow) {
            $show_admin_bar = false;
        } else {
            $show_admin_bar = _get_admin_bar_pref();
        }
    }
    /**
     * Filters whether to show the admin bar.
     *
     * Returning false to this hook is the recommended way to hide the admin bar.
     * The user's display preference is used for logged in users.
     *
     * @since 3.1.0
     *
     * @param bool $show_admin_bar Whether the admin bar should be shown. Default false.
     */
    $show_admin_bar = apply_filters('show_admin_bar', $show_admin_bar);
    return $show_admin_bar;
}

WordPress Version: 5.5

/**
 * Determines whether the admin bar should be showing.
 *
 * For more information on this and similar theme functions, check out
 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
 * Conditional Tags} article in the Theme Developer Handbook.
 *
 * @since 3.1.0
 *
 * @global bool   $show_admin_bar
 * @global string $pagenow
 *
 * @return bool Whether the admin bar should be showing.
 */
function is_admin_bar_showing()
{
    global $show_admin_bar, $pagenow;
    // For all these types of requests, we never want an admin bar.
    if (defined('XMLRPC_REQUEST') || defined('DOING_AJAX') || defined('IFRAME_REQUEST') || wp_is_json_request()) {
        return false;
    }
    if (is_embed()) {
        return false;
    }
    // Integrated into the admin.
    if (is_admin()) {
        return true;
    }
    if (!isset($show_admin_bar)) {
        if (!is_user_logged_in() || 'wp-login.php' === $pagenow) {
            $show_admin_bar = false;
        } else {
            $show_admin_bar = _get_admin_bar_pref();
        }
    }
    /**
     * Filters whether to show the admin bar.
     *
     * Returning false to this hook is the recommended way to hide the admin bar.
     * The user's display preference is used for logged in users.
     *
     * @since 3.1.0
     *
     * @param bool $show_admin_bar Whether the admin bar should be shown. Default false.
     */
    $show_admin_bar = apply_filters('show_admin_bar', $show_admin_bar);
    return $show_admin_bar;
}

WordPress Version: 5.1

/**
 * Determines whether the admin bar should be showing.
 *
 * For more information on this and similar theme functions, check out
 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
 * Conditional Tags} article in the Theme Developer Handbook.
 *
 * @since 3.1.0
 *
 * @global bool   $show_admin_bar
 * @global string $pagenow
 *
 * @return bool Whether the admin bar should be showing.
 */
function is_admin_bar_showing()
{
    global $show_admin_bar, $pagenow;
    // For all these types of requests, we never want an admin bar.
    if (defined('XMLRPC_REQUEST') || defined('DOING_AJAX') || defined('IFRAME_REQUEST') || wp_is_json_request()) {
        return false;
    }
    if (is_embed()) {
        return false;
    }
    // Integrated into the admin.
    if (is_admin()) {
        return true;
    }
    if (!isset($show_admin_bar)) {
        if (!is_user_logged_in() || 'wp-login.php' == $pagenow) {
            $show_admin_bar = false;
        } else {
            $show_admin_bar = _get_admin_bar_pref();
        }
    }
    /**
     * Filters whether to show the admin bar.
     *
     * Returning false to this hook is the recommended way to hide the admin bar.
     * The user's display preference is used for logged in users.
     *
     * @since 3.1.0
     *
     * @param bool $show_admin_bar Whether the admin bar should be shown. Default false.
     */
    $show_admin_bar = apply_filters('show_admin_bar', $show_admin_bar);
    return $show_admin_bar;
}

WordPress Version: 5.0

/**
 * Determines whether the admin bar should be showing.
 * 
 * For more information on this and similar theme functions, check out
 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ 
 * Conditional Tags} article in the Theme Developer Handbook.
 * 
 * @since 3.1.0
 *
 * @global bool   $show_admin_bar
 * @global string $pagenow
 *
 * @return bool Whether the admin bar should be showing.
 */
function is_admin_bar_showing()
{
    global $show_admin_bar, $pagenow;
    // For all these types of requests, we never want an admin bar.
    if (defined('XMLRPC_REQUEST') || defined('DOING_AJAX') || defined('IFRAME_REQUEST')) {
        return false;
    }
    if (is_embed()) {
        return false;
    }
    // Integrated into the admin.
    if (is_admin()) {
        return true;
    }
    if (!isset($show_admin_bar)) {
        if (!is_user_logged_in() || 'wp-login.php' == $pagenow) {
            $show_admin_bar = false;
        } else {
            $show_admin_bar = _get_admin_bar_pref();
        }
    }
    /**
     * Filters whether to show the admin bar.
     *
     * Returning false to this hook is the recommended way to hide the admin bar.
     * The user's display preference is used for logged in users.
     *
     * @since 3.1.0
     *
     * @param bool $show_admin_bar Whether the admin bar should be shown. Default false.
     */
    $show_admin_bar = apply_filters('show_admin_bar', $show_admin_bar);
    return $show_admin_bar;
}

WordPress Version: 4.6

/**
 * Determine whether the admin bar should be showing.
 *
 * @since 3.1.0
 *
 * @global bool   $show_admin_bar
 * @global string $pagenow
 *
 * @return bool Whether the admin bar should be showing.
 */
function is_admin_bar_showing()
{
    global $show_admin_bar, $pagenow;
    // For all these types of requests, we never want an admin bar.
    if (defined('XMLRPC_REQUEST') || defined('DOING_AJAX') || defined('IFRAME_REQUEST')) {
        return false;
    }
    if (is_embed()) {
        return false;
    }
    // Integrated into the admin.
    if (is_admin()) {
        return true;
    }
    if (!isset($show_admin_bar)) {
        if (!is_user_logged_in() || 'wp-login.php' == $pagenow) {
            $show_admin_bar = false;
        } else {
            $show_admin_bar = _get_admin_bar_pref();
        }
    }
    /**
     * Filters whether to show the admin bar.
     *
     * Returning false to this hook is the recommended way to hide the admin bar.
     * The user's display preference is used for logged in users.
     *
     * @since 3.1.0
     *
     * @param bool $show_admin_bar Whether the admin bar should be shown. Default false.
     */
    $show_admin_bar = apply_filters('show_admin_bar', $show_admin_bar);
    return $show_admin_bar;
}

WordPress Version: 4.5

/**
 * Determine whether the admin bar should be showing.
 *
 * @since 3.1.0
 *
 * @global bool   $show_admin_bar
 * @global string $pagenow
 *
 * @return bool Whether the admin bar should be showing.
 */
function is_admin_bar_showing()
{
    global $show_admin_bar, $pagenow;
    // For all these types of requests, we never want an admin bar.
    if (defined('XMLRPC_REQUEST') || defined('DOING_AJAX') || defined('IFRAME_REQUEST')) {
        return false;
    }
    if (is_embed()) {
        return false;
    }
    // Integrated into the admin.
    if (is_admin()) {
        return true;
    }
    if (!isset($show_admin_bar)) {
        if (!is_user_logged_in() || 'wp-login.php' == $pagenow) {
            $show_admin_bar = false;
        } else {
            $show_admin_bar = _get_admin_bar_pref();
        }
    }
    /**
     * Filter whether to show the admin bar.
     *
     * Returning false to this hook is the recommended way to hide the admin bar.
     * The user's display preference is used for logged in users.
     *
     * @since 3.1.0
     *
     * @param bool $show_admin_bar Whether the admin bar should be shown. Default false.
     */
    $show_admin_bar = apply_filters('show_admin_bar', $show_admin_bar);
    return $show_admin_bar;
}

WordPress Version: 4.4

/**
 * Determine whether the admin bar should be showing.
 *
 * @since 3.1.0
 *
 * @global WP_Admin_Bar $wp_admin_bar
 * @global string       $pagenow
 *
 * @return bool Whether the admin bar should be showing.
 */
function is_admin_bar_showing()
{
    global $show_admin_bar, $pagenow;
    // For all these types of requests, we never want an admin bar.
    if (defined('XMLRPC_REQUEST') || defined('DOING_AJAX') || defined('IFRAME_REQUEST')) {
        return false;
    }
    if (is_embed()) {
        return false;
    }
    // Integrated into the admin.
    if (is_admin()) {
        return true;
    }
    if (!isset($show_admin_bar)) {
        if (!is_user_logged_in() || 'wp-login.php' == $pagenow) {
            $show_admin_bar = false;
        } else {
            $show_admin_bar = _get_admin_bar_pref();
        }
    }
    /**
     * Filter whether to show the admin bar.
     *
     * Returning false to this hook is the recommended way to hide the admin bar.
     * The user's display preference is used for logged in users.
     *
     * @since 3.1.0
     *
     * @param bool $show_admin_bar Whether the admin bar should be shown. Default false.
     */
    $show_admin_bar = apply_filters('show_admin_bar', $show_admin_bar);
    return $show_admin_bar;
}

WordPress Version: 4.3

/**
 * Determine whether the admin bar should be showing.
 *
 * @since 3.1.0
 *
 * @global WP_Admin_Bar $wp_admin_bar
 * @global string       $pagenow
 *
 * @return bool Whether the admin bar should be showing.
 */
function is_admin_bar_showing()
{
    global $show_admin_bar, $pagenow;
    // For all these types of requests, we never want an admin bar.
    if (defined('XMLRPC_REQUEST') || defined('DOING_AJAX') || defined('IFRAME_REQUEST')) {
        return false;
    }
    // Integrated into the admin.
    if (is_admin()) {
        return true;
    }
    if (!isset($show_admin_bar)) {
        if (!is_user_logged_in() || 'wp-login.php' == $pagenow) {
            $show_admin_bar = false;
        } else {
            $show_admin_bar = _get_admin_bar_pref();
        }
    }
    /**
     * Filter whether to show the admin bar.
     *
     * Returning false to this hook is the recommended way to hide the admin bar.
     * The user's display preference is used for logged in users.
     *
     * @since 3.1.0
     *
     * @param bool $show_admin_bar Whether the admin bar should be shown. Default false.
     */
    $show_admin_bar = apply_filters('show_admin_bar', $show_admin_bar);
    return $show_admin_bar;
}

WordPress Version: 3.8

/**
 * Determine whether the admin bar should be showing.
 *
 * @since 3.1.0
 *
 * @return bool Whether the admin bar should be showing.
 */
function is_admin_bar_showing()
{
    global $show_admin_bar, $pagenow;
    // For all these types of requests, we never want an admin bar.
    if (defined('XMLRPC_REQUEST') || defined('DOING_AJAX') || defined('IFRAME_REQUEST')) {
        return false;
    }
    // Integrated into the admin.
    if (is_admin()) {
        return true;
    }
    if (!isset($show_admin_bar)) {
        if (!is_user_logged_in() || 'wp-login.php' == $pagenow) {
            $show_admin_bar = false;
        } else {
            $show_admin_bar = _get_admin_bar_pref();
        }
    }
    /**
     * Filter whether to show the admin bar.
     *
     * Returning false to this hook is the recommended way to hide the admin bar.
     * The user's display preference is used for logged in users.
     *
     * @since 3.1.0
     *
     * @param bool $show_admin_bar Whether the admin bar should be shown. Default false.
     */
    $show_admin_bar = apply_filters('show_admin_bar', $show_admin_bar);
    return $show_admin_bar;
}

WordPress Version: 3.7

/**
 * Determine whether the admin bar should be showing.
 *
 * @since 3.1.0
 *
 * @return bool Whether the admin bar should be showing.
 */
function is_admin_bar_showing()
{
    global $show_admin_bar, $pagenow;
    // For all these types of requests, we never want an admin bar.
    if (defined('XMLRPC_REQUEST') || defined('DOING_AJAX') || defined('IFRAME_REQUEST')) {
        return false;
    }
    // Integrated into the admin.
    if (is_admin()) {
        return true;
    }
    if (!isset($show_admin_bar)) {
        if (!is_user_logged_in() || 'wp-login.php' == $pagenow) {
            $show_admin_bar = false;
        } else {
            $show_admin_bar = _get_admin_bar_pref();
        }
    }
    $show_admin_bar = apply_filters('show_admin_bar', $show_admin_bar);
    return $show_admin_bar;
}