Remove Admin from Recent Comments List (No Plugin)

Last week, I had written how you could greet your first time commentators with a simple tweak. Here is another tweak with which you can remove your (admin) name from the Recent Comments list. And this time again, no plugins involved πŸ™‚

I guess you are a bit confused on what we are going to do, the following images will explain.

Recent Comments: Before and After

Recent Comments: Before and After

Out-of-the-box: I saw the top commentator widgets on some blogs showing the author himself as the top commentator. There is an option to remove you from the list in the options of the Top Commentator Widget itself. Please write your name in that widget and get yourself removed.

Moving out of Recent Comments

This time again, we exploit the real meaning of open source Content Management System, we edit the WordPress Core. Follow the steps. Written for WordPress 2.7.1, steps must be similar in future versions too.

Find the file widgets.php in wp-includes folder.
Download the file and backup a copy, just in case.
Open the widgets.php in your favorite code editor. Notepad++ is my favorite.
Go to Line 1393 to find

$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT $number");

Add a condition which delimits the fetch query from fetching a particular name. The code will look like:

$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_approved = '1' AND comment_author != 'YOUR-NAME-HERE' ORDER BY comment_date_gmt DESC LIMIT $number");

Replace YOUR-NAME-HERE with the display name of the admin. I used Arun Basil Lal.
Upload the file to the server, overwriting the old widgets.php file. That’s it.

Known Issues:

When a new WordPress Update comes it might replace the widgets.php file with a new version. Then you will have to repeat this again.

Update: In WordPress 2.8.1 the target file is default-widgets.php in the same folder as widgets.php.

Hello, I am Arun Basil Lal. Thank you for reading!

I am a WordPress product developer and creator of Image Attributes Pro. I am passionate about solving problems and travelling the world.

Divi WordPress Theme - My Review

Divi WordPress Theme
Divi is a WordPress theme that web designers do not want you to know. It comes with a drag-and-drop theme builder. You can build beautiful looking unique websites without touching a line of code. Just choose from one of the many pre-made layouts, or pick elements and arrange them any way you like.

Divi is every WordPress developer's wet dream. Surprise your clients with neat responsive websites and have fun building them.

Divi comes from Elegant Themes. If you enjoy building websites, you *need* an Elegant Themes membership. 87 beautiful themes and 5 plugins for the cost of less than a candy-bar each!

Note: I am an avid user of Divi myself and this is a honest review. I wouldn't recommend something that I do not personally find amazing.


  1. Amal Roy says:

    Good post. Now more wordpress users will be benefited by this one. Good thinking.

  2. Rishi says:

    Thanks for the tip Arun! I’ll be implementing this tonight!

  3. George says:


    A good tweak,If the author of this plugin follow your line of thinking.This could have come as an option in plug in setting.Even I am planning to do the same very soon.

  4. Arun says:

    Great Post.but an experienced WordPress user will never try to touch the core files of can use any other advanced recent comments plugins out there.

    “But wordpress don’t update widgets.php with every update so you won’t have to repeat this every time”

    Please refer this page link is modified.

    • But people who love to handle code, like ex-programmers or core php freaks love to do it the code way rather than a plugin way. Ofcourse a plugin makes it lot easier, but where is all the fun?

      Thanks for that link, I had never noticed that. Kudos πŸ™‚

  5. Meet Her Here says:

    I have a number of websites and blogs, and I use WordPress for one of my blogs. WordPress is quickly becoming my blog management of choice, but it is more complicated to use (if you incorporate your own domain) than it is with other systems – Blogger, for example. That’s why I appreciate technology efficient bloggers like yourself who have the ability to give WordPress users detailed instructions on how to tweak their blogs. When you go into the WordPress core, that can be a scary thing. I hesitate to do it. However, if we have a technology efficient blogger giving us correct instructions on how to tweak – we can feel safer. I don’t know that I will need to put this particular WordPress tip into play. I’m satisfied with things right now. But thanks!

    • IMHO, WordPress is not complicated. It is powerful and looks good, but its half as complicated as Blogger. Since Blogger is not opensource, the only thing that you get to play with is the code of the template. And there is a drag-and-drop layout editor for that, I guess thats what makes people think Blogger is simple.

      Trust me, you will fall addict to wordpress soon!
      Thanks for the good words,

  6. Nihar says:

    This is great but i would like you to use author id instead of author name because, there might be case where you might have a guy with same name.

    I know it is hard to find arun basil lal. but for ex: in my blog i use nihar as the name (without sirname).

  7. TheAnand says:

    Good tip Arun πŸ™‚ I also wanted to implement this for a long time, but my laziness got better of me each time.

    But these days i do not want to do this because, my comments as the admin might be what some people expect on a post as a reply to their query or something…not seeing it in the regular stream might piss them off sometimes πŸ™‚

    • Anand,
      You have a point there. Actually I am using that to my advantage. I can stay invisible by removing my comments from the stream (evil me πŸ˜‰ )
      Moreover, if a commentator is expecting a reply, he would have already subscribed to future comments for the post. But as you said, some might assume that the admin never replies to comments at the first sight πŸ™

      Cheers πŸ™‚

  8. Nice one ! Gonna remove admin from mine too ! πŸ™‚

  9. nomercy says:

    thanks Arun … setelah saya coba, kode tersebut berjalan dengan sangat baik … saya menambahkannya pada artikel yang kebetulan mengenai cara menambahkan recent comment di blog saya …
    I’m sorry … i can’t english πŸ™‚

  10. nobihai says:

    Thanks you very much.

  11. Recently I saw your name in Recent Comments ?

    Any intention ? SEO ?

    • Remember? it was a hack in the WordPress core. after the upgrade to 2.8 I havent changed it yet.. Am waiting for 2.8.1 to come out. Will change it once its here πŸ™‚

  12. ezinonulan says:

    if u use 2.8, find that in comments.php

  13. ankara oto kiralama says:

    Thanks you very much.

1 Pings / Trackbacks.

  1. Trik Cepat: Recent Comments Tanpa Plugin dan Widget | | Ardiansyah’s Blog says:

    […] filterisasi komentar admin, sumber: Remove Admin from Recent Comments List (No Plugin) dari blognya mas Arun Basil […]

Leave a Reply

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