wpseek.com
WordPress开发者和主题制作者的搜索引擎



_get_admin_bar_pref › WordPress Function

Since3.1.0
已弃用n/a
_get_admin_bar_pref ( $context = 'front', $user = 0 )
访问:
  • private
参数: (2)
  • (string) $context Context of this preference check. Defaults to 'front'. The 'admin' preference is no longer used.
    Required: No
    默认: 'front'
  • (int) $user Optional. ID of the user to check, defaults to 0 for current user.
    Required: No
    默认:
返回:
  • (bool) Whether the admin bar should be showing for this user.
定义在:
文档:

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