这在前端站点wp管理栏中非常有效:
add_action(\'wp_before_admin_bar_render\', \'customize_admin_bar\');
function customize_admin_bar() {
global $wp_admin_bar;
if (is_user_logged_in()) {
if ( !is_admin()) {
$wp_admin_bar->remove_menu(\'edit-profile\');
//$wp_admin_bar->remove_menu(\'user-info\');
$wp_admin_bar->remove_menu(\'comments\');
$wp_admin_bar->remove_menu(\'new-media\');
$wp_admin_bar->remove_menu(\'new-tvr_booking\');
$wp_admin_bar->remove_menu(\'new-vp_orbitslides\');
$wp_admin_bar->remove_menu(\'orbitslider_settings\');
//$wp_admin_bar->remove_menu(\'site-name\');
//$wp_admin_bar->remove_menu(\'dashboard\');
/*$wp_admin_bar->add_menu( array(
\'id\' => \'custom-account\',
\'parent\' => \'my-account\',
\'title\' => __( \'Mi cuenta\'),
\'href\' => \'/pedidos/products-page/your-account/\'
) );*/
}
}
}
但不在wp admin菜单栏中,为什么?