Change Admin Bar “Visit Site” URL

I am using this code to open the admin “Visit Site” URL in a new window. How could I modify the code to also point the URL to a custom page? e.g.

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.


Read more here:: Change Admin Bar “Visit Site” URL

Leave a Reply

Your email address will not be published. Required fields are marked *