How to change WordPress user ID?

Is this enough to change the user ID? I’m doing this for security purposes, where the administrator has user ID=1 and I want to keep all posts, pages and content.

UPDATE wp_posts SET post_author="1000" WHERE post_author="1";
UPDATE wp_users SET ID = '1000' WHERE ID = '1';
UPDATE wp_usermeta SET user_id = '1000' WHERE user_id = '1';

ALTER TABLE wp_users AUTO_INCREMENT = 1001;

Is there a WordPress function to do it globally?

3 Answers
3

Why not make a new account for this user which will generate a new database ID. Then delete the user with the ID of 1 and attribute all posts / content to the new user you created for them? Then you don’t have to worry about queries or messing up your database. Also, as said before this makes absolutely no sense from a security standpoint as it’s pointless. If your client doesn’t trust you enough and wants to micromanage the site security they clearly know nothing about, might be time to dump that client.

Leave a Comment