diff --git a/wp-includes/rss.php b/wp-includes/rss.php
index d4732b7e29..ab3e9e9ec8 100644
--- a/wp-includes/rss.php
+++ b/wp-includes/rss.php
@@ -817,23 +817,26 @@ function parse_w3cdtf ( $date_str ) {
}
}
-function wp_rss ($url, $num_items) {
- //ini_set("display_errors", false); uncomment to suppress php errors thrown if the feed is not returned.
- $rss = fetch_rss($url);
- if ( $rss ) {
- echo "
";
- }
- else {
- echo 'An error has occurred the feed is probably down, try again later.';
+function wp_rss( $url, $num_items = -1 ) {
+ if ( $rss = fetch_rss( $url ) ) {
+ echo '';
+
+ if ( $num_items !== -1 ) {
+ $rss->items = array_slice( $rss->items, 0, $num_items );
+ }
+
+ foreach ( $rss->items as $item ) {
+ printf(
+ '- %3$s
',
+ clean_url( $item['link'] ),
+ attribute_escape( strip_tags( $item['description'] ) ),
+ htmlentities( $item['title'] )
+ );
+ }
+
+ echo '
';
+ } else {
+ _e( 'An error has occurred, which probably means the feed is down. Try again later.' );
}
}