WordPress开发者和主题制作者的搜索引擎



wp_admin_bar_dashboard_view_site_menu ›

Since3.2.0
已弃用3.3.0
wp_admin_bar_dashboard_view_site_menu ( $wp_admin_bar )
参数:
  • (WP_Admin_Bar) $wp_admin_bar WP_Admin_Bar instance.
    Required: Yes
定义在:
文档:

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



源码

function wp_admin_bar_dashboard_view_site_menu( $wp_admin_bar ) {
	_deprecated_function( __FUNCTION__, '3.3.0' );

	$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() ) );
	}
}