Here’s one way to achieve this:
/**
* Display a random feed in the RSS Widget
* Activated by the wpse_random_url string in the feed url
*
* @see http://wordpress.stackexchange.com/a/187599/26350
*/
! is_admin() && add_filter( 'wp_feed_options', function( $feed, $url )
{
// Modify this list of feeds to your needs:
$urls = [
'http://stackoverflow.com/feeds/',
'http://wordpress.stackexchange.com/feeds',
'http://unix.stackexchange.com/feeds'
];
// Select a random feed from the above list:
if( class_exists( '\SimplePie' )
&& $feed instanceof \SimplePie
&& false !== strpos( $url, 'wpse_random_url' )
&& method_exists( $feed, 'set_feed_url' )
)
$feed->set_feed_url( $urls[ array_rand( $urls ) ] );
return $feed;
}, 10, 2 );
where our feed url must contain the wpse_random_url
string.
We could for example use our current site’s feed, with the random_url GET parameter:
http://example.tld/feed/?wpse_random_url
and add that to the url field of the RSS widget:
The next step to improve this mini plugin, would be to introduce a way to add the list of feeds, directly from the backend instead of having to modify it within the code itself.