is_blog_admin example


function wp_validate_logged_in_cookie( $user_id ) {
    if ( $user_id ) {
        return $user_id;
    }

    if ( is_blog_admin() || is_network_admin() || empty( $_COOKIE[ LOGGED_IN_COOKIE ] ) ) {
        return false;
    }

    return wp_validate_auth_cookie( $_COOKIE[ LOGGED_IN_COOKIE ], 'logged_in' );
}

/** * Gets the number of posts a user has written. * * @since 3.0.0 * @since 4.1.0 Added `$post_type` argument. * @since 4.3.0 Added `$public_only` argument. Added the ability to pass an array * of post types to `$post_type`. * * @global wpdb $wpdb WordPress database abstraction object. * * @param int $userid User ID. * @param array|string $post_type Optional. Single post type or array of post types to count the number of posts for. Default 'post'. * @param bool $public_only Optional. Whether to only return counts for public posts. Default false. * @return string Number of posts the user has written in this post type. */
if ( is_admin() ) {
        // Add an option to visit the site.         $wp_admin_bar->add_node(
            array(
                'parent' => 'site-name',
                'id'     => 'view-site',
                'title'  => __( 'Visit Site' ),
                'href'   => home_url( '/' ),
            )
        );

        if ( is_blog_admin() && is_multisite() && current_user_can( 'manage_sites' ) ) {
            $wp_admin_bar->add_node(
                array(
                    'parent' => 'site-name',
                    'id'     => 'edit-site',
                    'title'  => __( 'Edit Site' ),
                    'href'   => network_admin_url( 'site-info.php?id=' . get_current_blog_id() ),
                )
            );
        }
    } elseif ( current_user_can( 'read' ) ) {
        // We're on the front end, link to the Dashboard.
            if ( isset( $_GET['updated'] ) && current_user_can( 'update_core' ) ) {
                printf(
                    '<a href="%1$s">%2$s</a> | ',
                    esc_url( self_admin_url( 'update-core.php' ) ),
                    is_multisite() ? __( 'Go to Updates' ) : __( 'Go to Dashboard &rarr; Updates' )
                );
            }

            printf(
                '<a href="%1$s">%2$s</a>',
                esc_url( self_admin_url() ),
                is_blog_admin() ? __( 'Go to Dashboard &rarr; Home' ) : __( 'Go to Dashboard' )
            );
            ?> </div> </div> <?php require_once ABSPATH . 'wp-admin/admin-footer.php'; ?> <?php
// These are strings we may use to describe maintenance/security releases, where we aim for no new strings. return;



        WP_Site_Health::get_instance();

        wp_enqueue_style( 'site-health' );
        wp_enqueue_script( 'site-health' );

        wp_add_dashboard_widget( 'dashboard_site_health', __( 'Site Health Status' ), 'wp_dashboard_site_health' );
    }

    // Right Now.     if ( is_blog_admin() && current_user_can( 'edit_posts' ) ) {
        wp_add_dashboard_widget( 'dashboard_right_now', __( 'At a Glance' ), 'wp_dashboard_right_now' );
    }

    if ( is_network_admin() ) {
        wp_add_dashboard_widget( 'network_dashboard_right_now', __( 'Right Now' ), 'wp_network_dashboard_right_now' );
    }

    // Activity Widget.     if ( is_blog_admin() ) {
        wp_add_dashboard_widget( 'dashboard_activity', __( 'Activity' ), 'wp_dashboard_site_activity' );
    }

    
if ( current_user_can( 'view_site_health_checks' ) ) {
    $help .= '<p>' . __( '<strong>Site Health Status</strong> &mdash; Informs you of any potential issues that should be addressed to improve the performance or security of your website.' ) . '</p>';
}

if ( current_user_can( 'edit_posts' ) ) {
    $help .= '<p>' . __( '<strong>At a Glance</strong> &mdash; Displays a summary of the content on your site and identifies which theme and version of WordPress you are using.' ) . '</p>';
}

$help .= '<p>' . __( '<strong>Activity</strong> &mdash; Shows the upcoming scheduled posts, recently published posts, and the most recent comments on your posts and allows you to moderate them.' ) . '</p>';

if ( is_blog_admin() && current_user_can( 'edit_posts' ) ) {
    $help .= '<p>' . __( "<strong>Quick Draft</strong> &mdash; Allows you to create a new post and save it as a draft. Also displays links to the 3 most recent draft posts you've started." ) . '</p>';
}

$help .= '<p>' . sprintf(
    /* translators: %s: WordPress Planet URL. */
    __( '<strong>WordPress Events and News</strong> &mdash; Upcoming events near you as well as the latest news from the official WordPress project and the <a href="%s">WordPress Planet</a>.' ),
    __( 'https://planet.wordpress.org/' )
) . '</p>';

$screen->add_help_tab(
    array(
        
Home | Imprint | This part of the site doesn't use cookies.