Easily Make WordPress Admin Area’s ‘Visit Site’ Link Open In New Tab

You can easily in just one click make your admin area’s ‘Visit Site’ link open in a new tab, best for the theme developers and web designers working on client sites. Visit Site In New Tab is the new very light weight WordPress plugin that automatically Makes “Visit Site” Link in “wp-admin” open in new tab.

Now there’s no need to right click on ‘Visit Site’ link for opening it in a new tab.

The plugin works on a small PHP hack so ALTERNATIVELY, you may copy-paste the following code in your theme’s function.php file and it works the same way:

add_action( 'admin_bar_menu', 'shatel_view', 999 );
function shatel_view( $wp_admin_bar ) {
    $all_toolbar_nodes = $wp_admin_bar->get_nodes();
    foreach ( $all_toolbar_nodes as $node ) {
        if($node->id == 'site-name' || $node->id == 'view-site')
        {
        $args = $node;
            $args->meta = array('target' => '_blank');
        $wp_admin_bar->add_node( $args );
        }
    }
}

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.