4 minutes

Include Custom Post Types in Your WordPress RSS Feed

By Editorial @stacktips, On Sep 17, 2023 Blog PostsWordpress 2.42K Views

What are the Feeds?

Feeds are the are the way to distribute your website content beyond readers on Browser. There are thousands of apps such as Feedly, Apple News, Facebook Instant Articles and many more RSS readers applications, that can read your website Feed and present your content to the wider audience.

Readers can also subscribe feeds via their email and get the content delivered directly to their email whenever new posts are published. This allows you to drive traffic to your website and you can also monetize your feeds.

WordPress Built-in Feeds

WordPress supports various conventional feed types such as RDF/RSS 1.0, RSS 2.0 and Atom feed out of the box. You don’t need to write any code to enable for your site.

However, it is enabled by default only for the default post types. If your website is using custom post type, you need to ask WordPress to include the custom post type into RSS feed.

The following code snippet will help you to include WordPress custom post types to your website RSS feed.

Add the following snippets to your WordPress theme functions.php file:

// Add links to rss feed 
function add_to_custom_feed($qv) {
	if (isset($qv['feed']) && !isset($qv['post_type']))
		$qv['post_type'] = array('post', 'books', 'events');
	return $qv;
add_filter('request', 'add_to_custom_feed');
Now save the changes in functions.php file and visit your WordPress site RSS feed URL.
For example, my site URL is Notice that now your RSS Feed will now have the posts from custom post types.
stacktips avtar


StackTips provides programming tutorials, how-to guides and code snippets on different programming languages.