How To Remove Pingbacks from Recent Comments Widget

WordPress comes with a default recent comment widget which allows you to display the most recent comments readers have left on your blog posts.

Must Read : How To Use Other Custom Shortcodes Inside Contact form 7

Although, this is a very useful feature, there is tiny issue with it. By default, this widget displays pingbacks along with the comments.

However, you can easily fix this problem by adding the following code to your functions.php file.

function ccw_remove_pingback_recent_comments( $array ) {
	$array['type'] = 'comment';
	return $array;
}
add_filter( 'widget_comments_args', 'ccw_remove_pingback_recent_comments' );

 

0 Comments

Leave a Comment.