wp_admin_bar_dashboard_view_site_menu

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

Description

wp_admin_bar_dashboard_view_site_menu( (WP_Admin_Bar) $wp_admin_bar ); 

Parameters (1)

0. $wp_admin_bar (WP_Admin_Bar)
WP_Admin_Bar instance.

Usage

  1. if ( !function_exists( 'wp_admin_bar_dashboard_view_site_menu' ) ) { 
  2. require_once ABSPATH . WPINC . '/deprecated.php'; 
  3.  
  4. // WP_Admin_Bar instance. 
  5. $wp_admin_bar = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wp_admin_bar_dashboard_view_site_menu($wp_admin_bar); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/deprecated.php  
  1. function wp_admin_bar_dashboard_view_site_menu( $wp_admin_bar ) { 
  2. _deprecated_function( __FUNCTION__, '3.3.0' ); 
  3.  
  4. $user_id = get_current_user_id(); 
  5.  
  6. if ( 0 != $user_id ) { 
  7. if ( is_admin() ) 
  8. $wp_admin_bar->add_menu( array( 'id' => 'view-site', 'title' => __( 'Visit Site' ), 'href' => home_url() ) ); 
  9. elseif ( is_multisite() ) 
  10. $wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => get_dashboard_url( $user_id ) ) ); 
  11. else 
  12. $wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => admin_url() ) );