如何更改管理栏的链接目标?

时间:2012-02-15 作者:JayteeHong

我想将管理栏的链接目标更改为“\\u blank”。我该在哪里做?谢谢

1 个回复
SO网友:Evan Yeung

function remove_admin_bar_links() {
    global $wp_admin_bar;
    $wp_admin_bar->remove_menu(\'site-name\');
}
add_action( \'wp_before_admin_bar_render\', \'remove_admin_bar_links\' );

function my_admin_bar_menu() {
    global $wp_admin_bar;
    if ( !is_super_admin() || !is_admin_bar_showing() )
        return;
    $wp_admin_bar->add_menu( array(
    \'id\' => \'site-name\',
    \'title\' => get_bloginfo(\'name\'),
    \'href\' => get_bloginfo(\'home_url\'),
    \'meta\' => array(\'target\' => \'_blank\' ) );
}
add_action(\'admin_bar_menu\', \'my_admin_bar_menu\');
实际上,你还可以做更多的事情。但这应该让你朝着正确的方向开始。

来源:
https://wordpress.stackexchange.com/questions/11522/just-wanted-to-share-about-the-admin-bar
http://wpengineer.com/2113/add-menus-to-the-admin-bar-of-wordpress/

结束

相关推荐