将此添加到主题functions.php
:
add_action( \'admin_bar_menu\', \'make_parent_node\', 999 );
function make_parent_node( $wp_admin_bar ) {
if ( ! is_admin() ) { return; } // end function if not in admin back-end, credit @Rarst
$args = array(
\'id\' => \'view-site\', // id of the existing child node (View Site)
\'title\' => \'Visit Site\', // alter the title of existing node (optional)
\'parent\' => false // set parent to false to make it a top level (parent) node
);
$wp_admin_bar->add_node( $args );
}
这将把“查看站点”移到仪表板下拉列表的右侧。有关更多信息,请参阅
Codex; 上面的代码来自“使现有子节点成为父节点”部分。