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.
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.
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.