_get_admin_bar_pref

函数


_get_admin_bar_pref ( $context = 'front', $user = 0 )
Access
Private
参数
  • (string)
    $context
    Context of this preference check. Defaults to ‘front’. The ‘admin’ preference is no longer used.
    Required:
    Default: ‘front’
  • (int)
    $user
    Optional. ID of the user to check, defaults to 0 for current user.
    Required:
返回值
  • (bool) Whether the admin bar should be showing for this user.
定义位置
  • wp-includes/admin-bar.php
    , line 1304
引入
3.1.0
弃用

Retrieves the admin bar display preference of a user.

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