wp_admin_bar_dashboard_view_site_menu

Definition:
function wp_admin_bar_dashboard_view_site_menu( $wp_admin_bar ) {}

Add the "Dashboard"/"Visit Site" menu.

Parameters

  • $wp_admin_bar

Source code

function wp_admin_bar_dashboard_view_site_menu( $wp_admin_bar ) {

	_deprecated_function( __FUNCTION__, '3.3' );



	$user_id = get_current_user_id();



	if ( 0 != $user_id ) {

		if ( is_admin() )

			$wp_admin_bar->add_menu( array( 'id' => 'view-site', 'title' => __( 'Visit Site' ), 'href' => home_url() ) );

		elseif ( is_multisite() )

			$wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => get_dashboard_url( $user_id ) ) );

		else

			$wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => admin_url() ) );

	}

}

17402

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: