
Definition
In WordPress, the_excerpt_rss() prints the post excerpt for a feed. It is used inside the description tag of an RSS item.
It gives plain text that is safe to place inside an XML feed.
Syntax
A few ways to call the_excerpt_rss().
<description><![CDATA[<?php the_excerpt_rss(); ?>]]></description>
| Call | What it does |
|---|
the_excerpt_rss() | Print the feed excerpt. |
the_excerpt() | The same idea for normal pages. |
It prints the excerpt and takes no arguments. Use it only in a feed template.
Full declaration
Parameters
| Parameter | Description |
|---|
(none) | This function takes no parameters. |
Return Value
| Return Value | Description |
|---|
| void | Nothing is returned. The excerpt is printed. |
WordPress Examples
Three short examples. Each one shows the code and what it prints.
Example 1 — Excerpt in a feed item
Use it as the description of an item.
<item>
<title><?php the_title_rss(); ?></title>
<description><![CDATA[<?php the_excerpt_rss(); ?>]]></description>
</item>
<item>
<title>Hello World</title>
<description><![CDATA[Welcome to WordPress. This is your first post.]]></description>
</item>
How It Works
the_title_rss() prints the item title.the_excerpt_rss() prints the excerpt.- CDATA lets the text hold special characters safely.
Example 2 — A hand written excerpt
If you wrote an excerpt in the editor, it is used.
<description><![CDATA[<?php the_excerpt_rss(); ?>]]></description>
<description><![CDATA[A short summary I wrote by hand.]]></description>
How It Works
- The Excerpt box of the editor has a custom summary.
the_excerpt_rss() prints that text.- No automatic cut is needed.
Example 3 — Excerpt for a normal page
On a normal page use the_excerpt(). It adds a paragraph tag.
<p>A short summary I wrote by hand.</p>
How It Works
the_excerpt() is for pages visitors see.- It wraps the text in a
p tag. the_excerpt_rss() is for feeds.
Frequently Asked Questions
It prints the excerpt of the current post for an RSS feed.
Inside the description tag of an item in a feed template.
No.
the_excerpt() is for web pages. the_excerpt_rss() is for XML feeds.
Yes. It works on the current post.
Browse all post functions
Open the functions index for simple guides with examples and FAQs.
Post Functions Index →About the author
Developer, cloud engineer, and technical writer
I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.
12 people found this page helpful