
如何创建WordPress网站浮动固定栏(页眉)
_get_admin_bar_pref ( $context = 'front', $user = 0 )
_get_admin_bar_pref: 这是一个用来获取用户对WordPress管理栏可见性的偏好的函数。它接收一个用户ID作为参数,并返回用户的偏好。
检索用户的管理栏显示偏好。
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; }