remove_node()删除工具栏的自定义链接

目录

描述

This function removes an item from the Toolbar. Toolbar items are also called "nodes".

The Toolbar replaces the Admin Bar since WordPress Version 3.3.

note: This function is a method of the WP_Admin_Bar class and $wp_admin_bar global object, which may not exist except during the 'admin_bar_menu' or 'wp_before_admin_bar_render' hooks.

remove_node() 描述

用法

<?php $wp_admin_bar->remove_node$id ); ?>

remove_node() 用法

参数

$id

(string) (必填) The node ID of the Toolbar item you want to remove .

默认值: None

remove_node() 参数

示例

Remove the WordPress Logo from the Toolbar

Put this in your theme's functions.php file.

/* ----------------------------------
 * wordpress之魂 © http://wphun.com
 * ---------------------------------- */

add_action( 'admin_bar_menu', 'remove_wp_logo', 999 );

function remove_wp_logo( $wp_admin_bar ) {
	$wp_admin_bar->remove_node( 'wp-logo' );
}

remove_node() 示例

源文件

remove_node() 函数的代码位于 wp-includes/class-wp-admin-bar.php.

remove_node() 源文件

相关