Forked from manchumahara/gist:0e1710721ab5741b68f3e8aad84fd8fd
Created
October 30, 2020 19:11
-
-
Save ImtiazEpu/89f02ffdcc163ad574e88070e838262c to your computer and use it in GitHub Desktop.
Single Click "Visit Site" Menu in WordPress Admin Bar(Admin Top Menu) https://manchumahara.com/?p=1266&preview=true
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'admin_bar_menu', 'admin_bar_menu_visitsite', 999 ); | |
function admin_bar_menu_visitsite( $wp_admin_bar ) { | |
if ( current_user_can( 'manage_options' ) ) { | |
$wp_admin_bar->add_node( | |
array( | |
'id' => 'visitsite', | |
'title' => 'Visit Site', | |
'href' => site_url(), | |
'meta' => array( 'class' => 'visitsite_adminbar', 'target' => '_blank' ), | |
) | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment