_get_admin_bar_pref()
Retrieves the admin bar display preference of a user.
Internal function — this function is designed to be used by the kernel itself. It is not recommended to use this function in your code.
No Hooks.
Returns
bool. Whether the admin bar should be showing for this user.
Usage
_get_admin_bar_pref( $context, $user );
- $context(string)
- Context of this preference check. The
'admin'preference is no longer used.
Default:'front' - $user(int)
- ID of the user to check.
Default:0 for current user
Changelog
| Since 3.1.0 | Introduced. |
_get_admin_bar_pref() get admin bar pref code WP 7.1
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;
}