
Definition
In WordPress, comment_author_rss() prints the comment author name in a format that is safe for an RSS feed.
It prints the name. It is used in feed templates, such as the comments feed, not in normal theme pages.
Syntax
It takes no arguments. Call it inside the loop of a comments feed.
| Call | What it does |
|---|
comment_author_rss() | Prints the name of the current comment author for a feed. |
get_comment_author_rss() | Returns the same name as a string. |
comment_author() | Use this one in normal theme pages. |
The name is filtered so it works inside XML.
Full declaration
comment_author_rss(): void
Parameters
| Parameter | Description |
|---|
| None | This function has no parameters. It uses the current comment. |
Return Value
| Return Value | Description |
|---|
| void | Nothing is returned. The function prints the author name. |
WordPress Examples
Three short theme examples. Each one has a sample output.
Example 1 — In a feed item
Print the author inside a custom comments feed item.
<item>
<dc:creator><![CDATA[<?php comment_author_rss(); ?>]]></dc:creator>
</item>
<item>
<dc:creator><![CDATA[Jane Doe]]></dc:creator>
</item>
How It Works
- A feed item is made for each comment.
comment_author_rss() prints the name.CDATA keeps special characters safe in XML.
Example 2 — In a feed title
Use the name in the title of a feed item.
<title>Comment by <?php comment_author_rss(); ?></title>
<title>Comment by Jane Doe</title>
How It Works
- The title text is built in your feed template.
- The name comes from the current comment.
- The output is plain text.
Example 3 — Return value
Use get_comment_author_rss() when you need a string.
<?php $author = get_comment_author_rss(); ?>
<author><?php echo esc_html( $author ); ?></author>
<author>Jane Doe</author>
How It Works
get_comment_author_rss() returns the name.esc_html() keeps the XML valid.- Use this when you build the tag yourself.
Frequently Asked Questions
It prints the name of the current comment author in a form that is safe for RSS.
In feed templates, such as a custom comments feed.
Both print the name. The RSS version is filtered for feeds.
No. It always uses the current comment.
Use get_comment_author_rss().
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.
14 people found this page helpful