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?
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?
Share Improve this question edited Apr 22, 2019 at 19:01 techr asked Apr 18, 2019 at 22:00 techrtechr 412 bronze badges 2- 2 Possible duplicate of How to get a feed for post type 'page'? – Sven Commented Apr 19, 2019 at 4:07
- No, that doesn't explain the lines of code suggested and the plugin isn't available for download through WordPress. – techr Commented Apr 22, 2019 at 19:02
1 Answer
Reset to default 1You 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/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