2

I'm working on a website with lots of tutorials/pages.

I have made a separate rss feed for the pages - works fine. But then I had to create a sitemap (a page), and it shows up in my "pages" rss feed!

My Question: How can I remove a specific post/page from a feed?

1

The quick and dirty way is set the published date a year or so in the past, past the oldest posts in the feed. There's also a nice plugin for this - Stealth Publish - where you set a flag in a custom field to exclude it from feeds and the home page feed.

  • XD never thought of that!! :D – Nick Jun 28 '12 at 20:07
  • I learned it by accident a few years ago - amazing how many things I've learned like that, actually. – SickHippie Jun 28 '12 at 20:10
0

A simple custom solution is also possible and you have not the overflow of this plugin, the ui and so on.

function fb_exclude_filter($query) {
    if ( !$query->is_admin && $query->is_feed) {
        $query->set('post__not_in', array(40, 9) ); // id of page or post
    }
    return $query;
}
add_filter( 'pre_get_posts', 'fb_exclude_filter' );

for more background information see my post

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.