_get_admin_bar_pref

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

WordPress Version: 5.9

/**
 * Retrieves the admin bar display preference of a user.
 *
 * @since 3.1.0
 * @access private
 *
 * @param string $context Context of this preference check. Defaults to 'front'. The 'admin'
 *                        preference is no longer used.
 * @param int    $user    Optional. ID of the user to check, defaults to 0 for current user.
 * @return bool Whether the admin bar should be showing for this user.
 */
function _get_admin_bar_pref($context = 'front', $user = 0)
{
    $pref = get_user_option("show_admin_bar_{$context}", $user);
    if (false === $pref) {
        return true;
    }
    return 'true' === $pref;
}

WordPress Version: 5.5

/**
 * Retrieve the admin bar display preference of a user.
 *
 * @since 3.1.0
 * @access private
 *
 * @param string $context Context of this preference check. Defaults to 'front'. The 'admin'
 *                        preference is no longer used.
 * @param int    $user    Optional. ID of the user to check, defaults to 0 for current user.
 * @return bool Whether the admin bar should be showing for this user.
 */
function _get_admin_bar_pref($context = 'front', $user = 0)
{
    $pref = get_user_option("show_admin_bar_{$context}", $user);
    if (false === $pref) {
        return true;
    }
    return 'true' === $pref;
}

WordPress Version: 5.1

/**
 * Retrieve the admin bar display preference of a user.
 *
 * @since 3.1.0
 * @access private
 *
 * @param string $context Context of this preference check. Defaults to 'front'. The 'admin'
 *  preference is no longer used.
 * @param int $user Optional. ID of the user to check, defaults to 0 for current user.
 * @return bool Whether the admin bar should be showing for this user.
 */
function _get_admin_bar_pref($context = 'front', $user = 0)
{
    $pref = get_user_option("show_admin_bar_{$context}", $user);
    if (false === $pref) {
        return true;
    }
    return 'true' === $pref;
}

WordPress Version: 3.7

/**
 * Retrieve the admin bar display preference of a user.
 *
 * @since 3.1.0
 * @access private
 *
 * @param string $context Context of this preference check. Defaults to 'front'. The 'admin'
 * 	preference is no longer used.
 * @param int $user Optional. ID of the user to check, defaults to 0 for current user.
 * @return bool Whether the admin bar should be showing for this user.
 */
function _get_admin_bar_pref($context = 'front', $user = 0)
{
    $pref = get_user_option("show_admin_bar_{$context}", $user);
    if (false === $pref) {
        return true;
    }
    return 'true' === $pref;
}