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

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
Add a comment  | 

1 Answer 1

Reset to default 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/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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745565581a4633372.html

相关推荐

  • 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

    13小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信