_wp_admin_bar_init
函数
_wp_admin_bar_init ( No parameters )
- Access
- Private
- 返回值
-
- (bool) Whether the admin bar was successfully initialized.
- 定义位置
-
-
wp-includes/admin-bar.php
, line 23
-
wp-includes/admin-bar.php
- 引入
- 3.1.0
- 弃用
- –
Instantiates the admin bar object and set it up as a global for access elsewhere.
UNHOOKING THIS FUNCTION WILL NOT PROPERLY REMOVE THE ADMIN BAR.
For that, use show_admin_bar(false) or the {@see ‘show_admin_bar’} filter.
function _wp_admin_bar_init() { global $wp_admin_bar; if ( ! is_admin_bar_showing() ) { return false; } /* Load the admin bar class code ready for instantiation */ require_once ABSPATH . WPINC . '/class-wp-admin-bar.php'; /* Instantiate the admin bar */ /** * Filters the admin bar class to instantiate. * * @since 3.1.0 * * @param string $wp_admin_bar_class Admin bar class to use. Default 'WP_Admin_Bar'. */ $admin_bar_class = apply_filters( 'wp_admin_bar_class', 'WP_Admin_Bar' ); if ( class_exists( $admin_bar_class ) ) { $wp_admin_bar = new $admin_bar_class; } else { return false; } $wp_admin_bar->initialize(); $wp_admin_bar->add_menus(); return true; }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。