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.


We are Australian WordPress specialists, MailChimp experts and Constant Contact solution sroviders
OrganicWeb are WordPress specialists, MailChimp Experts and Constant Contact Solution Providers.
We deliver results for small and large organizations worldwide.

Speak Your Mind

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