Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

share|improve this question

1 Answer 1

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:
Just wanted to share about the Admin Bar
http://wpengineer.com/2113/add-menus-to-the-admin-bar-of-wordpress/

share|improve this answer
    
Thank you very much. gave me a lot hints! –  JayteeHong Feb 16 '12 at 8:16
    
Thanks a lot. ^^ –  JayteeHong Aug 12 '12 at 6:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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