When renaming your WP admin user, don’t neglect your comments

A few months ago, popular people in the WordPress community (including Matt) made a push to stop using the user name “admin.” A considerably-sized brute force attack targeted this user name specifically since so many users never change or create an administrator with another name.

I followed the wisdom of the crowd and this post I found that walks you through the process of creating a new user and deleting “admin” while moving all the posts in the process. It wasn’t until a few weeks later when I noticed a problem.

I like to use themes that highlight my comments. This allows users to quickly find my updates about plugins and answers to questions that have been asked in a sea of one hundred comments. Well, all the comments I wrote while my user ID was 1 and my user name was admin were no longer highlighted.

There is a user_id column in the wp_comments table that is not changed when you delete a user and move their posts to a new owner. You need to run a MySQL query like this to implement the fix:

UPDATE wp_comments SET user_id = 11132 WHERE user_id = 1

Before executing a query like this on a WP database, the new administrator’s user ID needs to be identified so you can change 11132, which is one of my user IDs. If you do not know how to find a user ID, search this page for “user id.”

Leave a comment

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