Title: get_rss
Published: April 25, 2014
Last modified: February 24, 2026

---

# get_rss( string $url, int $num_items = 5 ): bool

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/get_rss/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/functions/get_rss/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/get_rss/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/get_rss/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/get_rss/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/get_rss/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/get_rss/?output_format=md#wp--skip-link--target)

Display RSS items in HTML list items.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/get_rss/?output_format=md#description)󠁿

You have to specify which HTML list you want, either ordered or unordered before
using the function. You also have to specify how many items you wish to display.
You can’t display all of them like you can with [wp_rss()](https://developer.wordpress.org/reference/functions/wp_rss/)
function.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/get_rss/?output_format=md#parameters)󠁿

 `$url`stringrequired

URL of feed to display. Will not auto sense feed URL.

`$num_items`intoptional

Number of items to display, default is all.

Default:`5`

## 󠀁[Return](https://developer.wordpress.org/reference/functions/get_rss/?output_format=md#return)󠁿

 bool False on failure.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/get_rss/?output_format=md#source)󠁿

    ```php
    function get_rss ($url, $num_items = 5) { // Like get posts, but for RSS
    	$rss = fetch_rss($url);
    	if ( $rss ) {
    		$rss->items = array_slice($rss->items, 0, $num_items);
    		foreach ( (array) $rss->items as $item ) {
    			echo "<li>\n";
    			echo "<a href='$item[link]' title='$item[description]'>";
    			echo esc_html($item['title']);
    			echo "</a><br />\n";
    			echo "</li>\n";
    		}
    	} else {
    		return false;
    	}
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/rss.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/rss.php#L938)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/rss.php#L938-L952)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/get_rss/?output_format=md#related)󠁿

| Uses | Description | 
| [fetch_rss()](https://developer.wordpress.org/reference/functions/fetch_rss/)`wp-includes/rss.php` |

Build Magpie object based on RSS from URL.

  | 
| [esc_html()](https://developer.wordpress.org/reference/functions/esc_html/)`wp-includes/formatting.php` |

Escaping for HTML blocks.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/get_rss/?output_format=md#changelog)󠁿

| Version | Description | 
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_rss%2F)
before being able to contribute a note or feedback.