• Skip to primary navigation
  • Skip to content

Neil Curtis

Learn how to make money online

  • Home
  • About
  • Start an Online Business
  • Latest Articles
  • My Resources
  • Contact

Add Custom Post Types to your WordPress Feed

By Neil on May 28, 2014

Custom post types are a fantastic way to sort your websites content and to make life easier for yourself by having set post types for set bits of content. However, these custom post types do not show in your websites feed (RSS feed) by default, which can impact on your websites potential reach and readership. You can see your websites feed by typing yourwebsitename.com/feed into the URL.

This is pretty easy to sort out though, and with some code added to your websites functions.php file you can get all your custom posts showing in your feed. The video below walks through the entire process, but also see the explanation below.

Step-by-step tutorial to show custom posts in your feed

Make a note of the slug of your custom post types because this is what you need to refer to in the code we are going to add to the functions.php file. You specified this slug when you set up your custom post type, but you can also easily see it by viewing one of your custom posts and looking at its URL. E.G. www.yourwebsitename.com/custom-post-type-slug/post-title.

In your WordPress dashboard open up the editor screen for your functions.php file. This is found under Appearance/editor and click on the file on the right-hand-side that says function.php (may be called Theme Functions).

Scroll to the bottom of the functions.php code and add the following:

//* Add custom post types to RSS feed
function myfeed_request($qv) {
if (isset($qv[‘feed’]) && !isset($qv[‘post_type’]))
$qv[‘post_type’] = array(‘custom-post-type-slug’, ‘another-custom-post-type-slug1’, ‘another-custom-post-type-slug2’);
return $qv;
}
add_filter(‘request’, ‘myfeed_request’);

The //* comments out this top line because it is there for reference. Replace custom-post-type-slug with your slug. You can specify several custom post types here.

Update these changes and you are done. Check your feed and your should see all of you custom posts showing up.

LIKE WHAT YOU’VE READ?
I publish new tutorials all the time so it would be great let you know when something is ready for you to check out. I also have lots more to share with you about how to easily customize and style your WordPress website, so why not join my gang.

TELL ME MORE >>

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Copyright © 2021 · NeilCurtis.me · Website powered by the Genesis Framework and uses the Maker Pro Theme

/* ----------------------------------------- */ /* Content Template: Guides Layout - start */ /* ----------------------------------------- */ #ninetypercent { width: 90%; margin: 0 auto; } #profilebox { border: dashed 2px #ccc; background: #E8E8E8; padding: 10px; padding-bottom: 15px; margin-bottom: 20px; } #profileimage { float: left; max-width: 150px; margin-right: 3%; } #profilebio { font-size: 90%; } #stepfont1 { float: left; font-size: 30px; font-weight: bold; padding: 5px; padding-left: 3%; background: #f96e5b; width: 100%; min-width: 280px; color: #FFFFFF; } #arrow { float: left; } #UWBwrap { padding-top: 10px; border-top: solid 3px #ccc; border-bottom: solid 3px #ccc; } /* ----------------------------------------- */ /* Content Template: Guides Layout - end */ /* ----------------------------------------- */