Retrieves the admin bar display preference of a user.
Parameters
$context
stringoptional- Context of this preference check. Defaults to
'front'
. The'admin'
preference is no longer used.Default:
'front'
$user
intoptional- ID of the user to check, defaults to 0 for current user.
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;
}
Changelog
Version | Description |
---|---|
3.1.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.