Back to Top

Remove pingbacks/trackbacks from Comments Feed

Previous Post:

Remove pingbacks/trackbacks from Comments Feed

If you have many visitors that subscribe to your blog’s default Comments Feed provided by WordPress, it could be a good idea that you do not include pingbacks/trackbacks in that feed. The reason is simple: your visitors want something useful, not some unimportant feedbacks from some totally unrelated websites.

To remove pingbacks/trackbacks from the Comments Feed, we will use the same technique described in one of my previous tips. So, all you have to do is to include this snippet in your theme’s functions.php file:

// Remove pingbacks/trackbacks from Comments Feed
// betterwp.net/wordpress-tips/remove-pingbackstrackbacks-from-comments-feed/
add_filter('request', 'bwp_filter_request');

function bwp_filter_request($qv)
{
	if (isset($qv['feed']) && !empty($qv['withcomments']))
	{
		add_filter('comment_feed_where', 'bwp_comment_feed_where');
	}
	return $qv;
}

function bwp_comment_feed_where($cwhere)
{
	$cwhere .= " AND comment_type = '' ";
	return $cwhere;
}

Now all your pingbacks/trackbacks will no longer be included in the Comments Feed! Remember to press Ctrl + F5 to force a refresh on the Feed’s page if you don’t see any change.

Take Social Sharing to
the Next Level with Monarch!

Take Social Sharing to the Next Level with Monarch!
Print Article Trackback Trackback to this Article   Subscribe to Comments RSS Subscribe to Comments RSS

2 Opinions for Remove pingbacks/trackbacks from Comments Feed

  1. User's Gravatar
    1
    sebastien March 31, 2011 at 10:54 am – Permalink

    Very useful tip, thank you!

  2. User's Gravatar
    2
    Sandy April 13, 2011 at 2:50 pm – Permalink

    Thanks for the tip – another tool in the fight against pingback spam :0)

Speak Up Your Mind!

An asterisk (*) indicates a required field and must be filled.




  • Web page and e-mail addresses turn into links automatically.
  • Wrap codes in: <code lang=""></code> or <pre lang="" extra="">
  • Lines and paragraphs break automatically.

Next Post: