RSSFeeds.com

WordPress RSS Feed

WordPress creates RSS feeds automatically for your posts, categories, tags, authors, searches and comments. This guide lists every feed URL, the settings that control them, code snippets to improve them and fixes for the errors you are most likely to meet.

Updated

Illustration of a blog CMS publishing an RSS feed

Every WordPress Feed URL

These work on every WordPress site with "pretty permalinks". Replace example.com and the parts in capitals.

FeedURL
Latest posts (RSS 2.0)https://example.com/feed/
Latest posts (Atom)https://example.com/feed/atom/
Latest posts (RSS 1.0 / RDF)https://example.com/feed/rdf/
All commentshttps://example.com/comments/feed/
Comments on one posthttps://example.com/POST-SLUG/feed/
Categoryhttps://example.com/category/SLUG/feed/
Taghttps://example.com/tag/SLUG/feed/
Authorhttps://example.com/author/USERNAME/feed/
Search resultshttps://example.com/?s=KEYWORDS&feed=rss2
Custom post typehttps://example.com/feed/?post_type=TYPE
Several categorieshttps://example.com/?cat=3,7&feed=rss2

Without pretty permalinks, use query strings: ?feed=rss2, ?feed=atom, ?cat=3&feed=rss2. WordPress adds autodiscovery tags for the main feed and comments feed to your theme's head automatically through add_theme_support('automatic-feed-links').

Feed Settings in WordPress

Under Settings › Reading:

  • Syndication feeds show the most recent – the number of items in each feed. 10 is the default; 20 to 30 is better for sites that publish several times a day.
  • For each post in a feed, include – Full text or Excerpt. Full text puts the whole article in content:encoded; readers prefer it. See full content or summaries.

Feeds are cached by most caching plugins and CDNs. After changing these settings, clear the cache and check the result with the Feed Validator.

Code Snippets to Improve Your Feed

Add these to a small plugin or your child theme's functions.php.

Add the Featured Image to Every Item

Readers show thumbnails from media:content. WordPress doesn't add it by default:

add_action('rss2_ns', function () {
    echo 'xmlns:media="http://search.yahoo.com/mrss/" ';
});

add_action('rss2_item', function () {
    if (!has_post_thumbnail()) return;
    [$url, $w, $h] = wp_get_attachment_image_src(get_post_thumbnail_id(), 'large');
    printf('<media:content url="%s" medium="image" width="%d" height="%d" />' . "\n", esc_url($url), $w, $h);
});

Delay Posts in the Feed

Published a post with a typo? A short delay gives you time to fix it before feed readers copy it:

add_filter('posts_where', function ($where, $query) {
    global $wpdb;
    if ($query->is_feed() && $query->is_main_query()) {
        $where .= $wpdb->prepare(" AND {$wpdb->posts}.post_date_gmt < %s", gmdate('Y-m-d H:i:s', time() - 15 * MINUTE_IN_SECONDS));
    }
    return $where;
}, 10, 2);

Include Custom Post Types in the Main Feed

add_action('pre_get_posts', function ($query) {
    if ($query->is_feed() && $query->is_main_query() && !$query->get('post_type')) {
        $query->set('post_type', ['post', 'podcast', 'video']);
    }
});

Exclude a Category from the Feed

add_action('pre_get_posts', function ($query) {
    if ($query->is_feed() && $query->is_main_query()) {
        $query->set('category__not_in', [12]);
    }
});

Add a Footer to Every Item

add_filter('the_content_feed', function ($content) {
    return $content . sprintf('<p>Originally published on <a href="%s">%s</a>.</p>', esc_url(get_permalink()), esc_html(get_bloginfo('name')));
});

Turn Feeds Off

Some sites (shops, intranets) don't need feeds. Remove the autodiscovery links and redirect feed requests to the home page:

remove_action('wp_head', 'feed_links', 2);
remove_action('wp_head', 'feed_links_extra', 3);
foreach (['do_feed', 'do_feed_rdf', 'do_feed_rss', 'do_feed_rss2', 'do_feed_atom'] as $hook) {
    add_action($hook, fn() => wp_redirect(home_url(), 301) && exit, 1);
}

Turning off feeds also stops feed readers, aggregators and many automation tools from following your site. Only do it if you are sure.

Fixing Common WordPress Feed Errors

ErrorCauseFix
XML declaration allowed only at the start of the documentWhitespace or a blank line before <?xml, usually after a closing ?> in functions.php or a pluginRemove closing ?> tags at the end of PHP files; disable plugins one by one to find the culprit
Feed shows HTML or a 404 pagePermalinks out of date, a security plugin or a maintenance modeSave Settings › Permalinks once; check plugin settings
Old posts reappear as newGUIDs changed after a domain or HTTPS migrationDon't search-replace the guid column in wp_posts
Feed not updatingPage cache or CDN caching the feed too longExclude /feed/ from long caching or purge on publish
Readers get "403 Forbidden"Firewall or bot protection blocking feed readersAllow-list feed URLs in your security plugin or CDN
Strange charactersCopy-pasted control characters or a broken charsetCheck blog_charset is UTF-8; validate the feed to find the item

Podcasting with WordPress

A WordPress category feed with audio enclosures can serve as a basic podcast feed, but it lacks the Apple Podcasts tags. Podcast plugins (such as Seriously Simple Podcasting or PowerPress) add those tags, artwork and a dedicated podcast feed. Check the result against the requirements in Podcast RSS.

Sources and Further Reading