Using WordPress ‘mu_rightnow_end’ PHP action

The mu_rightnow_end WordPress PHP action fires at the end of the ‘Right Now’ widget in the Network Admin dashboard.

Usage

add_action('mu_rightnow_end', 'your_custom_function');

function your_custom_function() {
    // your custom code here
}

Parameters

  • None

More information

See WordPress Developer Resources: mu_rightnow_end

Examples

Display the total number of users in a Multisite network

Add the total number of users to the ‘Right Now’ widget in the Network Admin dashboard.

add_action('mu_rightnow_end', 'display_total_users');

function display_total_users() {
    $user_count = get_user_count();
    echo '<strong>Total Users:</strong> ' . $user_count;
}

Display the total number of published posts in a Multisite network

Add the total number of published posts to the ‘Right Now’ widget in the Network Admin dashboard.

add_action('mu_rightnow_end', 'display_total_published_posts');

function display_total_published_posts() {
    $post_count = wp_count_posts('post')->publish;
    echo '<strong>Total Published Posts:</strong> ' . $post_count;
}

Display the total number of comments in a Multisite network

Add the total number of comments to the ‘Right Now’ widget in the Network Admin dashboard.

add_action('mu_rightnow_end', 'display_total_comments');

function display_total_comments() {
    $comment_count = wp_count_comments()->approved;
    echo '<strong>Total Comments:</strong> ' . $comment_count;
}

Display the total number of sites in a Multisite network

Add the total number of sites to the ‘Right Now’ widget in the Network Admin dashboard.

add_action('mu_rightnow_end', 'display_total_sites');

function display_total_sites() {
    $site_count = get_blog_count();
    echo '<strong>Total Sites:</strong> ' . $site_count;
}

Display the total number of themes in a Multisite network

Add the total number of themes to the ‘Right Now’ widget in the Network Admin dashboard.

add_action('mu_rightnow_end', 'display_total_themes');

function display_total_themes() {
    $themes = wp_get_themes();
    $theme_count = count($themes);
    echo '<strong>Total Themes:</strong> ' . $theme_count;
}