is_admin_bar_showing()
is_admin_bar_showing() 确定是否应显示管理栏。Determines whether th…
is_admin_bar_showing()
确定是否应显示管理栏。
Determines whether the admin bar should be showing.
确定是否应显示管理栏。
Determines whether the admin bar should be showing.
目录锚点:#说明#返回#源码#笔记
说明(Description)
有关此主题函数和类似主题函数的更多信息,请参阅主题开发人员手册中的条件标记文章。
返回(Return)
(bool)是否应该显示管理栏。
源码(Source)
/**
* Determine whether the admin bar should be showing.
*
* @since 3.1.0
*
* @global WP_Admin_Bar $wp_admin_bar
* @global string $pagenow
*
* @return bool Whether the admin bar should be showing.
*/
function is_admin_bar_showing() {
global $show_admin_bar, $pagenow;
// For all these types of requests, we never want an admin bar.
if ( defined('XMLRPC_REQUEST') || defined('DOING_AJAX') || defined('IFRAME_REQUEST') )
return false;
// Integrated into the admin.
if ( is_admin() )
return true;
if ( ! isset( $show_admin_bar ) ) {
if ( ! is_user_logged_in() || 'wp-login.php' == $pagenow ) {
$show_admin_bar = false;
} else {
$show_admin_bar = _get_admin_bar_pref();
}
}
/**
* Filter whether to show the admin bar.
*
* Returning false to this hook is the recommended way to hide the admin bar.
* The user's display preference is used for logged in users.
*
* @since 3.1.0
*
* @param bool $show_admin_bar Whether the admin bar should be shown. Default false.
*/
$show_admin_bar = apply_filters( 'show_admin_bar', $show_admin_bar );
return $show_admin_bar;
}| 更新版本 | 源码位置 | 使用 | 被使用 |
|---|---|---|---|
| 3.1.0 | wp-includes/admin-bar.php:1189 | 4 | 7 |
笔记(Notes)
基本示例
类别:WordPress 函数手册、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。

还没有任何评论,赶紧来占个楼吧!