On this page
_get_admin_bar_pref( string $context = 'front', int $user ): bool
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Retrieves the admin bar display preference of a user.
Parameters
$contextstring Optional-
Context of this preference check. Defaults to
'front'. The'admin'preference is no longer used.Default:
'front' $userint 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.
Source
File: wp-includes/admin-bar.php. View all references
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;
}
Related
Uses
| Uses | Description |
|---|---|
| get_user_option() wp-includes/user.php | Retrieves user option that can be either per Site or per Network. |
Used By
| Used By | Description |
|---|---|
| is_admin_bar_showing() wp-includes/admin-bar.php | Determines whether the admin bar should be showing. |
Changelog
| Version | Description |
|---|---|
| 3.1.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/_get_admin_bar_pref