_get_admin_bar_pref

Advertisement

Private Access Private Access

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.

Summery Summery

Retrieve the admin bar display preference of a user.

Syntax Syntax

_get_admin_bar_pref( string $context = 'front', int $user )

Parameters Parameters

$context

(Optional) Context of this preference check. Defaults to 'front'. The 'admin' preference is no longer used.

Default value: 'front'

$user

(Optional) ID of the user to check, defaults to 0 for current user.

Return Return

(bool) Whether the admin bar should be showing for this user.

Source Source

File: wp-includes/admin-bar.php

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;
}

Advertisement

Changelog Changelog

Changelog
Version Description
3.1.0 Introduced.

Advertisement

Leave a Reply