SimplePie::merge_items()public staticWP 1.0

Merge items from several feeds into one

If you're merging multiple feeds together, they need to all have dates for the items or else SimplePie will refuse to sort them.

Method of the class: SimplePie{}

No Hooks.




$result = SimplePie::merge_items( $urls, $start, $end, $limit );
$urls(array) (required)
List of SimplePie feed objects to merge
Starting item
Number of items to return
Maximum number of items per feed

SimplePie::merge_items() code WP 6.4.1

public static function merge_items($urls, $start = 0, $end = 0, $limit = 0)
	if (is_array($urls) && sizeof($urls) > 0)
		$items = array();
		foreach ($urls as $arg)
			if ($arg instanceof SimplePie)
				$items = array_merge($items, $arg->get_items(0, $limit));
				trigger_error('Arguments must be SimplePie objects', E_USER_WARNING);

		usort($items, array(get_class($urls[0]), 'sort_items'));

		if ($end === 0)
			return array_slice($items, $start);

		return array_slice($items, $start, $end);

	trigger_error('Cannot merge zero SimplePie objects', E_USER_WARNING);
	return array();