The Developer’s Guide to Feeds in WordPress

Share this article

A feed is a data format used for providing users with frequently updated content. Feed readers are used to read a feed, thereby allowing users to subscribe to it. Making a collection of feeds accessible in one spot is known as aggregation, which is performed by a feed aggregator.

WordPress Feeds

In this tutorial I’ll show you the different kinds of feed formats provided by WordPress and how to access them, with a focus on customizing them programmatically.

Feed Formats Supported by WordPress

WordPress supports four popular feed formats: RDF, RSS 0.92, RSS 2.0 and Atom. RSS 2.0 is the most popular feed format and is supported by almost every feed reader.

The URL paths for these feeds are:

You don’t have to hardcode them into your themes or plugins, you can just use the following functions to retrieve the URLs of the various feed formats:


These URLs retrieve the latest ‘posts’ of the site.

WordPress Recent Comments Feed

The above paths provide the latest posts of the site. To find recent comments we need to use the comments specific feed path:

If you don’t want to hardcode it, you can use this function to retrieve the comments feed:


WordPress also provides a feed for comments of a single post. To find the recent comments of a specific post the feed path is:

Again, if you don’t want to hardcode it, you can use this function to retrieve it:

    post_comments_feed_link('link_text', 'post_id', 'rss2' );

WordPress Category Feed

WordPress provides a feed for every category. The feed path for a single category or multiple categories is:,id2&feed=rss2

You can use this function to retrieve the feed URL of a single category or multiple categories by using the following:

    get_category_feed_link('id1', 'rss2');

Similarly, you can also get the feed URL of a tag or multiple tags too.

WordPress Author Feed

WordPress also provides a feed for the recent posts of an author. This is useful if a user wants to follow a particular author via a feed.

The URL path of an author’s feed can be constructed using the below code:

    echo '<a href="' . get_author_link(0, $authordata->ID, $authordata->user_nicename) . 'feed/">' . the_author($idmode, false) . '</a>';

Note: WordPress doesn’t provide any built-in functions to retrieve the URL of an author feed.

WordPress Search Feed

WordPress can also retrieve a feed for a search term. Here’s the feed URL path for a search term:

Check Feed Request

In your theme or plugin, you can check if a request is a feed request or not by using the below code:

        echo "Feed Request";

Here we are using the is_feed() function to check if the current request is a feed request or not. If yes, then it returns true.

WordPress internally uses a built in feed template to display feeds. Using the do_feed action we can define our own feed templates.

Remove Feeds

If you don’t want to provide feeds on your site, then you can use the code below to disable all of them:


    function disable_feed() 
        wp_die(__("Feed Disabled"));
    add_action('do_feed',      'disable_feed', 1);
    add_action('do_feed_rdf',  'disable_feed', 1);
    add_action('do_feed_rss',  'disable_feed', 1);
    add_action('do_feed_rss2', 'disable_feed', 1);
    add_action('do_feed_atom', 'disable_feed', 1);

Filtering Feed Content

To filter the description of a post in a feed only we can use the_content_feed filter. Here is an example on how to use it:

function feed_word_count($content)
   $content .= 'Total '.str_word_count($content).' words';
   return $content;

add_filter("the_content_feed", "feed_word_count");

In WordPress 3.0 onwards, there is a theme support feature to add feed URLs to the head tag. If you’re a WordPress theme developer, then add this line of code to your theme’s function.php file to enable this feature.

add_theme_support( 'automatic-feed-links' );

Redirecting WordPress Feeds to FeedBurner Feeds

Many site administrators prefer to provide their feeds using FeedBurner (or other third party services). This lets them track their feeds and number of subscribers.

The dirty way to do this is by adding the below code to .htaccess file

<IfModule mod_rewrite.c>
 RewriteEngine on
 RewriteCond %{HTTP_USER_AGENT} !FeedBurner    [NC]
 RewriteCond %{HTTP_USER_AGENT} !FeedValidator [NC]
 RewriteRule ^feed/?([_0-9a-z-]+)?/?$ [R=302,NC,L]

This code redirects requests to the latest posts feed to FeedBurner.

If you’re hesitant to touch your .htaccess file, then you can use FeedBurner Plugin to do the same thing.

More Actions and Filters

WordPress provides many more actions and filters to customize our feeds. We’ve only covered some of the most important and useful ones.

You can find many more feed related actions at WordPress Action Reference and filters at WordPress Filter Reference.


Many WordPress users prefer feed subscriptions rather than email or social subscriptions. As feed aggregators are now available for all platforms it’s a good idea to provide users an option to subscribe via feeds, with RSS 2.0 being the preferred format. You should also display an author feed and a comments feed if you have commenting enabled, not just recent posts feed.

Let me know your experience with WordPress feeds below.

Frequently Asked Questions (FAQs) about WordPress Feeds

What is a WordPress feed and why is it important?

A WordPress feed is a type of web feed format that allows users to subscribe to your content. It’s important because it allows your readers to receive updates from your site directly in their feed readers or email, without having to visit your website. This can significantly increase your site’s reach and engagement.

How can I customize my WordPress feed?

WordPress provides several ways to customize your feed. You can modify the number of posts in your feed, change the content type (full text or summary), and even add custom content to your feed using plugins or code snippets. You can also create custom feeds for specific categories, tags, or authors.

How can I troubleshoot issues with my WordPress feed?

If you’re experiencing issues with your WordPress feed, there are several steps you can take. First, check your feed URL to ensure it’s correct. If your feed is not updating, it could be due to a caching issue. Try clearing your site’s cache and see if that resolves the issue. If you’re still experiencing problems, it could be due to a plugin conflict. Try deactivating your plugins one by one to see if that resolves the issue.

How can I add a feed to my WordPress site?

Adding a feed to your WordPress site is relatively straightforward. You can use the built-in RSS widget, or you can use a plugin to add more advanced feed functionality. You can also manually add a feed to your site using PHP code.

How can I optimize my WordPress feed for SEO?

Optimizing your WordPress feed for SEO involves several steps. First, make sure your feed includes full text, not just a summary. This will ensure that search engines can fully index your content. You should also include relevant keywords in your feed titles and descriptions. Finally, consider using a plugin to add more advanced SEO features to your feed, such as custom fields and metadata.

Can I create multiple feeds on my WordPress site?

Yes, WordPress allows you to create multiple feeds for different types of content. For example, you can create separate feeds for your blog posts, comments, and even custom post types. This can be a great way to segment your content and provide more targeted updates to your readers.

How can I secure my WordPress feed?

Securing your WordPress feed involves several steps. First, make sure your WordPress installation and all your plugins are up to date. This will help protect your feed from known vulnerabilities. You should also consider using a security plugin to add additional protections to your feed, such as IP blocking and brute force attack prevention.

Can I monetize my WordPress feed?

Yes, there are several ways to monetize your WordPress feed. You can include ads in your feed content, or you can offer premium feeds for a fee. You can also use your feed to promote affiliate products or your own products and services.

How can I track the performance of my WordPress feed?

Tracking the performance of your WordPress feed can be done using various tools and plugins. You can use Google Analytics to track how many people are subscribing to your feed and how they are interacting with your content. You can also use feed-specific analytics tools to get more detailed insights into your feed’s performance.

Can I integrate my WordPress feed with social media?

Yes, you can integrate your WordPress feed with social media to automatically share your new posts on your social media channels. This can be a great way to increase your reach and engagement. There are several plugins available that can help you automate this process.

Narayan PrustyNarayan Prusty
View Author

Narayan is a web astronaut. He is the founder of QNimate. He loves teaching. He loves to share ideas. When not coding he enjoys playing football. You will often find him at QScutter classes.

Share this article
Read Next
Get the freshest news and resources for developers, designers and digital creators in your inbox each week
Loading form