WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to create a filter to make in sort that the link in the admin bar to open in a new window. I know that the right-click -> open in a new tab is a common use for us programmers but for the client who use it, it could be great to open in a new tab.

enter image description here

Hope to find a solution without changing the core file "admin-bar.php" so it won't get overwrite on any WP's updates.

share|improve this question
up vote 2 down vote accepted

This is actually easily done. I just adapted the code from this answer

add_action( 'admin_bar_menu', 'customize_my_wp_admin_bar', 80 );
function customize_my_wp_admin_bar( $wp_admin_bar ) {

    //Get a reference to the view-site node to modify.
    $node = $wp_admin_bar->get_node('view-site');

    //Change target
    $node->meta['target'] = '_blank';

    //Update Node.


To change any other item in the menu bar you just need to find the id of the item to change and adapt get_node. Look in /wp-includes/admin-bar.php for the id or have a look at the css classes of the output.

share|improve this answer
Nice it works. Just like that, is it possible to add this action on the parent. The one with the little house icon ? – Warface Jun 6 '14 at 14:40
Have a look at the edited answer. You are looking for id site-name in wp-includes/admin-bar.php:285 – kraftner Jun 6 '14 at 14:47

Your Answer


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.