2

I'd like to change the admin bar's link target to "_blank". where what should I do? thanks.

1 Answer 1

4
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');

There is actually a lot more you can do. But this should get your started in the right direction.

Sources:
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/

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.