How to remove a Post from the RSS Feed

For whatever reason you may need to Publish a WordPress Post without having that Post show in the Feed. The Post will still show on your Website however feed subscribers won’t see the Post (and any services such as Mailchimp or Aweber that use your Feed won’t ‘see’ the Blog Post).

Just add the code below to your functions.php and replace 2151, 2217, 2401 with your Post numbers/IDs:

function ge_post_exclude($where, $wp_query = NULL) {
	global $wpdb;
	if ( !$wp_query )
		global $wp_query;
	if ($wp_query->is_feed) {
		$where .= " AND $wpdb->posts.ID NOT IN (2152, 2217, 2401)";
	return $where;
add_filter( 'posts_where','ge_post_exclude', 1, 2 );

Please note that I’ve been using this code for awhile and attained it from somewhere but I just can’t recall where.


Australian MailChimp and WordPress services

WordPress Specialists & MailChimp Experts.

OrganicWeb provides leading WordPress and MailChimp solutions from Australia to the world.

Speak Your Mind

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>