/**
 * Dashboard: Visit Site link new tab
 */
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 );
        }
    }
}

This feature modifies the WordPress admin bar. Here is a brief explanation of the feature:

1. add_action( 'admin_bar_menu', 'shatel_view', 999 );
– This line appends the function shatel_view to the action admin_bar_menu from WordPress, with a priority of 999. This action is called when the admin menu is created. A high priority (999) ensures that this function is called after most other functions.

2. function shatel_view( $wp_admin_bar )
– The function shatel_view is defined, and it takes a WP_Admin_Barobject as an argument.

3. $all_toolbar_nodes = $wp_admin_bar->get_nodes();
– Here the function fetches all nodes (menu entries) from the admin bar.

4. foreach ( $all_toolbar_nodes as $node )
– This function goes through every node (every menu item in the admin bar).

5. if($node->id == 'site-name' || $node->id == 'view-site')
– If the ID of the current node 'site name' or 'view-site' , the following block is executed. These IDs probably represent the “Visit Page” link.

6. $args = $node;
– The current node is stored in the variable $args saved.

7. $args->meta = array('target' => '_blank');
- The metaattribute of the node is changed so that the link appears in a new tab (_blank) opens when clicked.

8. $wp_admin_bar->add_node( $args );
– Finally, the modified node is added back to the admin bar.

In summary:

The function modifies the WordPress admin bar so that the links with the IDs 'site name' and 'view-site' will open in a new tab when clicked.