wp_dashboard_cached_rss_widget

Advertisement

Summery Summery

Checks to see if all of the feed url in $check_urls are cached.

Syntax Syntax

wp_dashboard_cached_rss_widget( string $widget_id, callable $callback, array $check_urls = array() )

Description Description

If $check_urls is empty, look for the rss feed url found in the dashboard widget options of $widget_id. If cached, call $callback, a function that echoes out output for this widget. If not cache, echo a "Loading…" stub which is later replaced by Ajax call (see top of /wp-admin/index.php)

Parameters Parameters

$widget_id

(string) (Required)

$callback

(callable) (Required)

$check_urls

(array) (Optional) RSS feeds

Default value: array()

Return Return

(bool) False on failure. True on success.

Source Source

File: wp-admin/includes/dashboard.php

	wp_reset_postdata();

	return true;
}

/**
 * Show Comments section.
 *
 * @since 3.8.0
 *
 * @param int $total_items Optional. Number of comments to query. Default 5.
 * @return bool False if no comments were found. True otherwise.
 */
function wp_dashboard_recent_comments( $total_items = 5 ) {
	// Select all comment types and filter out spam later for better query performance.
	$comments = array();

	$comments_query = array(
		'number' => $total_items * 5,
		'offset' => 0,
	);
	if ( ! current_user_can( 'edit_posts' ) ) {
		$comments_query['status'] = 'approve';
	}

	while ( count( $comments ) < $total_items && $possible = get_comments( $comments_query ) ) {
		if ( ! is_array( $possible ) ) {
			break;
		}
		foreach ( $possible as $comment ) {
			if ( ! current_user_can( 'read_post', $comment->comment_post_ID ) ) {
				continue;
			}
			$comments[] = $comment;

Advertisement

Changelog Changelog

Changelog
Version Description
2.5.0 Introduced.

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.