Title: wp_dashboard_right_now
Published: April 25, 2014
Last modified: April 28, 2025

---

# wp_dashboard_right_now()

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/wp_dashboard_right_now/?output_format=md#description)
 * [Source](https://developer.wordpress.org/reference/functions/wp_dashboard_right_now/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/functions/wp_dashboard_right_now/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/functions/wp_dashboard_right_now/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_dashboard_right_now/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/wp_dashboard_right_now/?output_format=md#wp--skip-link--target)

Dashboard widget that displays some basic stats about the site.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/wp_dashboard_right_now/?output_format=md#description)󠁿

Formerly ‘Right Now’. A streamlined ‘At a Glance’ as of 3.8.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/wp_dashboard_right_now/?output_format=md#source)󠁿

    ```php
    function wp_dashboard_right_now() {
    	?>
    	<div class="main">
    	<ul>
    	<?php
    	// Posts and Pages.
    	foreach ( array( 'post', 'page' ) as $post_type ) {
    		$num_posts = wp_count_posts( $post_type );

    		if ( $num_posts && $num_posts->publish ) {
    			if ( 'post' === $post_type ) {
    				/* translators: %s: Number of posts. */
    				$text = _n( '%s Post', '%s Posts', $num_posts->publish );
    			} else {
    				/* translators: %s: Number of pages. */
    				$text = _n( '%s Page', '%s Pages', $num_posts->publish );
    			}

    			$text             = sprintf( $text, number_format_i18n( $num_posts->publish ) );
    			$post_type_object = get_post_type_object( $post_type );

    			if ( $post_type_object && current_user_can( $post_type_object->cap->edit_posts ) ) {
    				printf( '<li class="%1$s-count"><a href="edit.php?post_type=%1$s">%2$s</a></li>', $post_type, $text );
    			} else {
    				printf( '<li class="%1$s-count"><span>%2$s</span></li>', $post_type, $text );
    			}
    		}
    	}

    	// Comments.
    	$num_comm = wp_count_comments();

    	if ( $num_comm && ( $num_comm->approved || $num_comm->moderated ) ) {
    		/* translators: %s: Number of comments. */
    		$text = sprintf( _n( '%s Comment', '%s Comments', $num_comm->approved ), number_format_i18n( $num_comm->approved ) );
    		?>
    		<li class="comment-count">
    			<a href="edit-comments.php"><?php echo $text; ?></a>
    		</li>
    		<?php
    		$moderated_comments_count_i18n = number_format_i18n( $num_comm->moderated );
    		/* translators: %s: Number of comments. */
    		$text = sprintf( _n( '%s Comment in moderation', '%s Comments in moderation', $num_comm->moderated ), $moderated_comments_count_i18n );
    		?>
    		<li class="comment-mod-count<?php echo ! $num_comm->moderated ? ' hidden' : ''; ?>">
    			<a href="edit-comments.php?comment_status=moderated" class="comments-in-moderation-text"><?php echo $text; ?></a>
    		</li>
    		<?php
    	}

    	/**
    	 * Filters the array of extra elements to list in the 'At a Glance'
    	 * dashboard widget.
    	 *
    	 * Prior to 3.8.0, the widget was named 'Right Now'. Each element
    	 * is wrapped in list-item tags on output.
    	 *
    	 * @since 3.8.0
    	 *
    	 * @param string[] $items Array of extra 'At a Glance' widget items.
    	 */
    	$elements = apply_filters( 'dashboard_glance_items', array() );

    	if ( $elements ) {
    		echo '<li>' . implode( "</li>\n<li>", $elements ) . "</li>\n";
    	}

    	?>
    	</ul>
    	<?php
    	update_right_now_message();

    	// Check if search engines are asked not to index this site.
    	if ( ! is_network_admin() && ! is_user_admin()
    		&& current_user_can( 'manage_options' ) && ! get_option( 'blog_public' )
    	) {

    		/**
    		 * Filters the link title attribute for the 'Search engines discouraged'
    		 * message displayed in the 'At a Glance' dashboard widget.
    		 *
    		 * Prior to 3.8.0, the widget was named 'Right Now'.
    		 *
    		 * @since 3.0.0
    		 * @since 4.5.0 The default for `$title` was updated to an empty string.
    		 *
    		 * @param string $title Default attribute text.
    		 */
    		$title = apply_filters( 'privacy_on_link_title', '' );

    		/**
    		 * Filters the link label for the 'Search engines discouraged' message
    		 * displayed in the 'At a Glance' dashboard widget.
    		 *
    		 * Prior to 3.8.0, the widget was named 'Right Now'.
    		 *
    		 * @since 3.0.0
    		 *
    		 * @param string $content Default text.
    		 */
    		$content = apply_filters( 'privacy_on_link_text', __( 'Search engines discouraged' ) );

    		$title_attr = '' === $title ? '' : " title='$title'";

    		echo "<p class='search-engines-info'><a href='options-reading.php'$title_attr>$content</a></p>";
    	}
    	?>
    	</div>
    	<?php
    	/*
    	 * activity_box_end has a core action, but only prints content when multisite.
    	 * Using an output buffer is the only way to really check if anything's displayed here.
    	 */
    	ob_start();

    	/**
    	 * Fires at the end of the 'At a Glance' dashboard widget.
    	 *
    	 * Prior to 3.8.0, the widget was named 'Right Now'.
    	 *
    	 * @since 2.5.0
    	 */
    	do_action( 'rightnow_end' );

    	/**
    	 * Fires at the end of the 'At a Glance' dashboard widget.
    	 *
    	 * Prior to 3.8.0, the widget was named 'Right Now'.
    	 *
    	 * @since 2.0.0
    	 */
    	do_action( 'activity_box_end' );

    	$actions = ob_get_clean();

    	if ( ! empty( $actions ) ) :
    		?>
    	<div class="sub">
    		<?php echo $actions; ?>
    	</div>
    		<?php
    	endif;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/dashboard.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-admin/includes/dashboard.php#L300)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-admin/includes/dashboard.php#L300-L442)

## 󠀁[Hooks](https://developer.wordpress.org/reference/functions/wp_dashboard_right_now/?output_format=md#hooks)󠁿

 [do_action( ‘activity_box_end’ )](https://developer.wordpress.org/reference/hooks/activity_box_end/)

Fires at the end of the ‘At a Glance’ dashboard widget.

 [apply_filters( ‘dashboard_glance_items’, string[] $items )](https://developer.wordpress.org/reference/hooks/dashboard_glance_items/)

Filters the array of extra elements to list in the ‘At a Glance’ dashboard widget.

 [apply_filters( ‘privacy_on_link_text’, string $content )](https://developer.wordpress.org/reference/hooks/privacy_on_link_text/)

Filters the link label for the ‘Search engines discouraged’ message displayed in
the ‘At a Glance’ dashboard widget.

 [apply_filters( ‘privacy_on_link_title’, string $title )](https://developer.wordpress.org/reference/hooks/privacy_on_link_title/)

Filters the link title attribute for the ‘Search engines discouraged’ message displayed
in the ‘At a Glance’ dashboard widget.

 [do_action( ‘rightnow_end’ )](https://developer.wordpress.org/reference/hooks/rightnow_end/)

Fires at the end of the ‘At a Glance’ dashboard widget.

## 󠀁[Related](https://developer.wordpress.org/reference/functions/wp_dashboard_right_now/?output_format=md#related)󠁿

| Uses | Description | 
| [update_right_now_message()](https://developer.wordpress.org/reference/functions/update_right_now_message/)`wp-admin/includes/update.php` |

Displays WordPress version and active theme in the ‘At a Glance’ dashboard widget.

  | 
| [_n()](https://developer.wordpress.org/reference/functions/_n/)`wp-includes/l10n.php` |

Translates and retrieves the singular or plural form based on the supplied number.

  | 
| [is_network_admin()](https://developer.wordpress.org/reference/functions/is_network_admin/)`wp-includes/load.php` |

Determines whether the current request is for the network administrative interface.

  | 
| [is_user_admin()](https://developer.wordpress.org/reference/functions/is_user_admin/)`wp-includes/load.php` |

Determines whether the current request is for a user admin screen.

  | 
| [wp_count_posts()](https://developer.wordpress.org/reference/functions/wp_count_posts/)`wp-includes/post.php` |

Counts number of posts of a post type and if user has permissions to view.

  | 
| [wp_count_comments()](https://developer.wordpress.org/reference/functions/wp_count_comments/)`wp-includes/comment.php` |

Retrieves the total comment counts for the whole site or a single post.

  | 
| [current_user_can()](https://developer.wordpress.org/reference/functions/current_user_can/)`wp-includes/capabilities.php` |

Returns whether the current user has the specified capability.

  | 
| [__()](https://developer.wordpress.org/reference/functions/__/)`wp-includes/l10n.php` |

Retrieves the translation of $text.

  | 
| [number_format_i18n()](https://developer.wordpress.org/reference/functions/number_format_i18n/)`wp-includes/functions.php` |

Converts float number to format based on the locale.

  | 
| [apply_filters()](https://developer.wordpress.org/reference/functions/apply_filters/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to a filter hook.

  | 
| [do_action()](https://developer.wordpress.org/reference/functions/do_action/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to an action hook.

  | 
| [get_option()](https://developer.wordpress.org/reference/functions/get_option/)`wp-includes/option.php` |

Retrieves an option value based on an option name.

  | 
| [get_post_type_object()](https://developer.wordpress.org/reference/functions/get_post_type_object/)`wp-includes/post.php` |

Retrieves a post type object by name.

  |

[Show 8 more](https://developer.wordpress.org/reference/functions/wp_dashboard_right_now/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/wp_dashboard_right_now/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/wp_dashboard_right_now/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_dashboard_right_now%2F)
before being able to contribute a note or feedback.