_get_admin_bar_pref()
Retrieves the admin bar display preference of a user.
Внутренняя функция — эта функция рассчитана на использование самим ядром. Не рекомендуется использовать эту функцию в своем коде.
Хуков нет.
Возвращает
true|false
. Whether the admin bar should be showing for this user.
Использование
_get_admin_bar_pref( $context, $user );
- $context(строка)
- Context of this preference check. The 'admin' preference is no longer used.
По умолчанию: 'front' - $user(int)
- ID of the user to check.
По умолчанию: 0 for current user
Список изменений
С версии 3.1.0 | Введена. |
Код _get_admin_bar_pref() get admin bar pref WP 6.7.2
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; }