add_menu example


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

/** * Checks if the current user belong to a given site. * * @since MU (3.0.0) * @deprecated 3.3.0 Use is_user_member_of_blog() * @see is_user_member_of_blog() * * @param int $blog_id Site ID * @return bool True if the current users belong to $blog_id, false if not. */
Home | Imprint | This part of the site doesn't use cookies.