WordPress is_feed() Function

Beginner
4 min read
Updated: Nov 2026
3 examples
Conditional tag

Definition

In WordPress, is_feed() returns true when the visitor (or a feed reader) asks for a feed, such as /feed/. On normal pages it returns false.

Use it to change what your code prints inside a feed. For example, you can skip ads or buttons that should not appear in an RSS reader.

Syntax

Use it as the test of an if statement.

WordPress
if ( is_feed() ) {
  // code for the true path
} else {
  // code for the false path
}
CallWhat it does
is_feed()True on any feed.
is_feed( 'atom' )True only on the Atom feed.
is_feed( array( 'rss2', 'atom' ) )True on either feed type.

Common feed types are rss2, atom, rss, rdf, and comments-rss2.

Full declaration
WordPress
is_feed( string|string[] $feeds = '' ): bool

Parameters

ParameterDescription
$feedsOptional. A feed type or an array of feed types. Default is empty, which means any feed.

Return Value

Return ValueDescription
booltrue if the main query is for a feed, otherwise false.

WordPress Examples

Three short theme examples. Each one shows what prints on the true path and the false path.

Example 1 — Add text to the feed only

Append a short line to every post inside the feed.

WordPress
function mytheme_feed_footer( $content ) {
  if ( is_feed() ) {
    $content .= '<p>Thanks for reading from RSS!</p>';
  }
  return $content;
}
add_filter( 'the_content', 'mytheme_feed_footer' );

How It Works

  1. The filter runs for every post content.
  2. is_feed() is true only in a feed request.
  3. The extra line is added in the feed, not on the site.

Example 2 — Check one feed type

Run code only for the Atom feed.

WordPress
<?php if ( is_feed( 'atom' ) ) {
  echo 'This is the Atom feed.';
} ?>

How It Works

  1. The argument 'atom' is the feed type.
  2. The tag is true only for that type.
  3. Pass an array to accept more than one type.

Example 3 — Skip a banner in the feed

Show a banner on the site but not in the feed.

WordPress
<?php if ( ! is_feed() ) {
  echo '<div class="promo">Join our newsletter</div>';
} ?>

How It Works

  1. ! is_feed() means the request is not a feed.
  2. The banner is printed only on normal pages.
  3. Feed readers get clean content.

Frequently Asked Questions

It returns true or false (a bool). Use it inside an if statement.
The default feed is at /feed/ on your site, for example https://example.com/feed/.
Yes, but run it after the query is ready, for example inside the_content or on the wp hook.
Yes. The comments feed is a feed too, so is_feed() is true there.
Conditional tags need the main query. Call them in template files or on hooks such as wp or template_redirect, not directly at the top of functions.php.

Next: is_front_page()

Check if the visitor is on the site front page.

is_front_page() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

7 people found this page helpful