_get_admin_bar_pref()WP 3.1.0

Retrieves the admin bar display preference of a user.

This is an internal function for using it by WP core itself. It's not recommended to use this function in your code.

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 6.0

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;