4

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?

  • 2
    Possible duplicate of How to get a feed for post type 'page'? – Sven Apr 19 '19 at 4:07
  • No, that doesn't explain the lines of code suggested and the plugin isn't available for download through WordPress. – techr Apr 22 '19 at 19:02
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.