_get_admin_bar_pref( string $context = 'front', int $user = 0 ): bool
- Since
- 3.1.0
- Source
wp-includes/admin-bar.php:1398
Retrieves the admin bar display preference of a user.
Parameters
$contextstringoptional- Context of this preference check. Defaults to 'front'. The 'admin' preference is no longer used.Default:
'front' $userintoptional- ID of the user to check, defaults to 0 for current user.Default:
0
Return
bool- Whether the admin bar should be showing for this user.
Uses · 1
- get_user_option()Retrieves user option that can be either per Site or per Network.
Used by · 1
- is_admin_bar_showing()Determines whether the admin bar should be showing.
Source
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;}History
Introduced in 3.1.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 6.8.8 tag, from
src/wp-includes/admin-bar.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.