Add Custom Post Types to WordPress Feed

  • follow us in feedly
Published March 8, 2013 by Brad Knutson
Custom Post Type in Feed

Apparently, unbeknownst to me, custom post types in WordPress are not by default included in the RSS feed. Only built-in WordPress “posts” are. So what if you have a custom post type of “blog” or “portfolio” like I do, and you want to include those in your feed? Out of the box, WordPress can’t help you.

After doing a lot of research, sifting through WordPress’ support forum, and playing with some plugins, I finally came up with a solution. Add the below snippet to your themes function.php file.

function myfeed_request($qv) {
	if (isset($qv['feed']) && !isset($qv['post_type']))
		$qv['post_type'] = array('post', 'blog', 'portfolio');
	return $qv;
add_filter('request', 'myfeed_request');

I purposely choose to explicitly list out the post types I want to display in an array, as opposed to using the WordPress built in function get_post_types(). The reasoning behind this is because perhaps you don’t want your pages to be in your RSS feed, or perhaps you have a custom post type that you don’t want included.

The biggest reason, however, is for WordPress users who have Jetpack installed. If you use the get_post_types() function, your “Feedbacks” will be displayed! This could potentially be extremely embarrassing and a PR nightmare! It’s important to leave those out of the equation and just include the post types you want your users to see in your RSS feed.

The following two tabs change content below.
Founder at Inbounderish
Brad Knutson is a Web Developer in the Twin Cities area of Minnesota. He has experience working with WordPress and Drupal, and also has an interest in SEO and Inbound Marketing.

Keep Up-to-Date



See a complete list of topics discussed in blog posts here.

Check These Out

Get 2 Weeks Free! Sign Up Today! Premium Managed WordPress Hosting Genesis Framework for WordPress SEO is complex. Tools should be simple. Thesis Theme for WordPress:  Options Galore and a Helpful Support Community

One thought on “Add Custom Post Types to WordPress Feed

Share Your Thoughts

Your email address will not be shown.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">