RSS for Pages Instead of Posts?

I’m trying to set up RSS. However, all the pages on my site are pages, not posts because the SEO is better (all my content is relevant regardless of publish date).

My RSS feed isn’t working right now and I was told it’s because I am using pages instead of posts. I don’t know PHP, but is there any way to set up the RSS to include pages as well? I could add a piece of PHP to the site if I asked my hosting service to do it for me and it wouldn’t break anything, but, if you do post any code, please explain exactly what each part does with comments just in case I need to add it myself.

Before all of that, though, is there another way?

1 Answer
1

You can includes pages inside your RSS feed by adding this code into your theme or child theme’s functions.php file (Child theme is preferred so it doesn’t get removed with updates).

I tested this on a fresh install and it works. You can easily test by going to yourdomain.com/feed/.

function feed_request($qv){
    $rss_post_types = array('post', 'page');
    if(isset($qv['feed']) && !isset($qv['post_type']))
        $qv['post_type'] = $rss_post_types;
    return $qv;
}
add_filter('request', 'feed_request');

Reference – here

Leave a Comment