WordPress at a glance
function is not described

_get_admin_bar_pref() WP 3.1.0

Retrieve the admin bar display preference of a user.

No Hooks.


true/false. Whether the admin bar should be showing for this user.


_get_admin_bar_pref( $context, $user );
Context of this preference check. The 'admin' preference is no longer used.
Default: 'front'
ID of the user to check.
Default: 0 for current user


Since 3.1.0 Introduced.

Code of get admin bar pref: wp-includes/admin-bar.php WP 5.2.2

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;