How To Remove Author Replies From Recent Comments Widget

Home » WordPress Tutorials » How To Remove Author Replies From Recent Comments Widget
  • Remove Author Replies

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!

By |2018-02-08T01:21:36+00:00February 8th, 2018|Categories: WordPress Tutorials|Tags: |0 Comments

About the Author:

Scott Hartley is a WordPress Developer who focuses on website performance optimization, SEO, and security. He can't tell you what a color wheel is but he knows the intricacies of making a website load quickly.

Leave A Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.