How To Remove Author Replies From Recent Comments Widget

WordPress comes with a widget that allows you to display recent comments and replies to your blog posts. This widget can be added to your sidebar and is quite handy to show active engagement on your website.

However, by default, this widget shows author replies and comments as well as user comments. This is quite annoying. For example, if you wrote the post and are replying to your users comments, the recent comments widget displays your comments too.

Instead of switching to a different recent comments plugin, there is a way to remove the post author replies from the recent comments widget inherent to WordPress.

To Remove Author Replies

Add the following code to one of the following places:

function wp_recent_comments_less_author( $array ) {

global $post; $array['user_id'] = !$post->post_author; return $array; }

add_action( 'widget_comments_args', 'wp_recent_comments_less_author' );

After adding the above code, author replies and comments will no longer appear on your website. Now you will not need to use another plugin to make your site seem more professional!

scott hartley

About the author

Scott is a web performance geek, lover of all things coffee, and avid video game player. His WordPress work delves into web performance, web security, and SEO.

1 thought on “How To Remove Author Replies From Recent Comments Widget”

Leave a Comment