Change Admin User IDs

One of the things I see a lot of in log files for WordPress site is scans for ?author=1. These are scans for admin users and can reveal the user name. Some security plugin will change the user ID for 1, but does not handle multiple user IDs that could be 2, 3 or 4. I’ve seen scans that check for IDs 1 through 99. Use the following mysql to change any admin user IDs to a larger number to make is harder to find admin users on the site. Set the current ID to an admin existing ID, and the new id should be a random ID that is much larger, and not currently used ID.

/* set the current and new id values before running
-------------------------------------------------------------*/
SET @current_id = 1;
SET @new_id = 1254;

/* updates to database to make the changes
--------------------------------------------------------------*/
UPDATE wp_users SET ID = @new_id WHERE ID = @current_id;
UPDATE wp_usermeta SET user_id = @new_id WHERE user_id = @current_id;
UPDATE wp_posts SET post_author = @new_id WHERE post_author = @current_id;
Scroll to Top