wp_widget_rss_process

The timeline below displays how wordpress function wp_widget_rss_process has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.1

/**
 * Process RSS feed widget data and optionally retrieve feed items.
 *
 * The feed widget can not have more than 20 items or it will reset back to the
 * default, which is 10.
 *
 * The resulting array has the feed title, feed url, feed link (from channel),
 * feed items, error (if any), and whether to show summary, author, and date.
 * All respectively in the order of the array elements.
 *
 * @since 2.5.0
 *
 * @param array $widget_rss RSS widget feed data. Expects unescaped data.
 * @param bool  $check_feed Optional. Whether to check feed for errors. Default true.
 * @return array
 */
function wp_widget_rss_process($widget_rss, $check_feed = true)
{
    $items = (int) $widget_rss['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $url = sanitize_url(strip_tags($widget_rss['url']));
    $title = isset($widget_rss['title']) ? trim(strip_tags($widget_rss['title'])) : '';
    $show_summary = isset($widget_rss['show_summary']) ? (int) $widget_rss['show_summary'] : 0;
    $show_author = isset($widget_rss['show_author']) ? (int) $widget_rss['show_author'] : 0;
    $show_date = isset($widget_rss['show_date']) ? (int) $widget_rss['show_date'] : 0;
    $error = false;
    $link = '';
    if ($check_feed) {
        $rss = fetch_feed($url);
        if (is_wp_error($rss)) {
            $error = $rss->get_error_message();
        } else {
            $link = esc_url(strip_tags($rss->get_permalink()));
            while (stristr($link, 'http') !== $link) {
                $link = substr($link, 1);
            }
            $rss->__destruct();
            unset($rss);
        }
    }
    return compact('title', 'url', 'link', 'items', 'error', 'show_summary', 'show_author', 'show_date');
}

WordPress Version: 5.9

/**
 * Process RSS feed widget data and optionally retrieve feed items.
 *
 * The feed widget can not have more than 20 items or it will reset back to the
 * default, which is 10.
 *
 * The resulting array has the feed title, feed url, feed link (from channel),
 * feed items, error (if any), and whether to show summary, author, and date.
 * All respectively in the order of the array elements.
 *
 * @since 2.5.0
 *
 * @param array $widget_rss RSS widget feed data. Expects unescaped data.
 * @param bool  $check_feed Optional. Whether to check feed for errors. Default true.
 * @return array
 */
function wp_widget_rss_process($widget_rss, $check_feed = true)
{
    $items = (int) $widget_rss['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $url = esc_url_raw(strip_tags($widget_rss['url']));
    $title = isset($widget_rss['title']) ? trim(strip_tags($widget_rss['title'])) : '';
    $show_summary = isset($widget_rss['show_summary']) ? (int) $widget_rss['show_summary'] : 0;
    $show_author = isset($widget_rss['show_author']) ? (int) $widget_rss['show_author'] : 0;
    $show_date = isset($widget_rss['show_date']) ? (int) $widget_rss['show_date'] : 0;
    $error = false;
    $link = '';
    if ($check_feed) {
        $rss = fetch_feed($url);
        if (is_wp_error($rss)) {
            $error = $rss->get_error_message();
        } else {
            $link = esc_url(strip_tags($rss->get_permalink()));
            while (stristr($link, 'http') !== $link) {
                $link = substr($link, 1);
            }
            $rss->__destruct();
            unset($rss);
        }
    }
    return compact('title', 'url', 'link', 'items', 'error', 'show_summary', 'show_author', 'show_date');
}

WordPress Version: 5.5

/**
 * Process RSS feed widget data and optionally retrieve feed items.
 *
 * The feed widget can not have more than 20 items or it will reset back to the
 * default, which is 10.
 *
 * The resulting array has the feed title, feed url, feed link (from channel),
 * feed items, error (if any), and whether to show summary, author, and date.
 * All respectively in the order of the array elements.
 *
 * @since 2.5.0
 *
 * @param array $widget_rss RSS widget feed data. Expects unescaped data.
 * @param bool  $check_feed Optional. Whether to check feed for errors. Default true.
 * @return array
 */
function wp_widget_rss_process($widget_rss, $check_feed = true)
{
    $items = (int) $widget_rss['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $url = esc_url_raw(strip_tags($widget_rss['url']));
    $title = isset($widget_rss['title']) ? trim(strip_tags($widget_rss['title'])) : '';
    $show_summary = isset($widget_rss['show_summary']) ? (int) $widget_rss['show_summary'] : 0;
    $show_author = isset($widget_rss['show_author']) ? (int) $widget_rss['show_author'] : 0;
    $show_date = isset($widget_rss['show_date']) ? (int) $widget_rss['show_date'] : 0;
    if ($check_feed) {
        $rss = fetch_feed($url);
        $error = false;
        $link = '';
        if (is_wp_error($rss)) {
            $error = $rss->get_error_message();
        } else {
            $link = esc_url(strip_tags($rss->get_permalink()));
            while (stristr($link, 'http') !== $link) {
                $link = substr($link, 1);
            }
            $rss->__destruct();
            unset($rss);
        }
    }
    return compact('title', 'url', 'link', 'items', 'error', 'show_summary', 'show_author', 'show_date');
}

WordPress Version: 5.4

/**
 * Process RSS feed widget data and optionally retrieve feed items.
 *
 * The feed widget can not have more than 20 items or it will reset back to the
 * default, which is 10.
 *
 * The resulting array has the feed title, feed url, feed link (from channel),
 * feed items, error (if any), and whether to show summary, author, and date.
 * All respectively in the order of the array elements.
 *
 * @since 2.5.0
 *
 * @param array $widget_rss RSS widget feed data. Expects unescaped data.
 * @param bool $check_feed Optional, default is true. Whether to check feed for errors.
 * @return array
 */
function wp_widget_rss_process($widget_rss, $check_feed = true)
{
    $items = (int) $widget_rss['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $url = esc_url_raw(strip_tags($widget_rss['url']));
    $title = isset($widget_rss['title']) ? trim(strip_tags($widget_rss['title'])) : '';
    $show_summary = isset($widget_rss['show_summary']) ? (int) $widget_rss['show_summary'] : 0;
    $show_author = isset($widget_rss['show_author']) ? (int) $widget_rss['show_author'] : 0;
    $show_date = isset($widget_rss['show_date']) ? (int) $widget_rss['show_date'] : 0;
    if ($check_feed) {
        $rss = fetch_feed($url);
        $error = false;
        $link = '';
        if (is_wp_error($rss)) {
            $error = $rss->get_error_message();
        } else {
            $link = esc_url(strip_tags($rss->get_permalink()));
            while (stristr($link, 'http') !== $link) {
                $link = substr($link, 1);
            }
            $rss->__destruct();
            unset($rss);
        }
    }
    return compact('title', 'url', 'link', 'items', 'error', 'show_summary', 'show_author', 'show_date');
}

WordPress Version: 3.7

/**
 * Process RSS feed widget data and optionally retrieve feed items.
 *
 * The feed widget can not have more than 20 items or it will reset back to the
 * default, which is 10.
 *
 * The resulting array has the feed title, feed url, feed link (from channel),
 * feed items, error (if any), and whether to show summary, author, and date.
 * All respectively in the order of the array elements.
 *
 * @since 2.5.0
 *
 * @param array $widget_rss RSS widget feed data. Expects unescaped data.
 * @param bool $check_feed Optional, default is true. Whether to check feed for errors.
 * @return array
 */
function wp_widget_rss_process($widget_rss, $check_feed = true)
{
    $items = (int) $widget_rss['items'];
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $url = esc_url_raw(strip_tags($widget_rss['url']));
    $title = isset($widget_rss['title']) ? trim(strip_tags($widget_rss['title'])) : '';
    $show_summary = isset($widget_rss['show_summary']) ? (int) $widget_rss['show_summary'] : 0;
    $show_author = isset($widget_rss['show_author']) ? (int) $widget_rss['show_author'] : 0;
    $show_date = isset($widget_rss['show_date']) ? (int) $widget_rss['show_date'] : 0;
    if ($check_feed) {
        $rss = fetch_feed($url);
        $error = false;
        $link = '';
        if (is_wp_error($rss)) {
            $error = $rss->get_error_message();
        } else {
            $link = esc_url(strip_tags($rss->get_permalink()));
            while (stristr($link, 'http') != $link) {
                $link = substr($link, 1);
            }
            $rss->__destruct();
            unset($rss);
        }
    }
    return compact('title', 'url', 'link', 'items', 'error', 'show_summary', 'show_author', 'show_date');
}