Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

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.

share|improve this answer
    
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
    
Same with me, but in html/php –  Nick Jun 28 '12 at 20:36

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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