getButterfly Logo getButterfly code wrangling since 2005

Do you know how certain security plugins advise against having a user with ID 1? Hacking a WordPress site involves other methods but if you are really determined (slash paranoid) to change it, try either of these options:

1. Run these queries in phpMyAdmin:

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';


2. Or create a new administrator user, then place this function in your functions.php file:

<?php wp_delete_user( $id, $reassign ); ?>

Make sure you replace the $id variable with 1 and the $reassign variable with the new user ID, the one you’ve just created. The function will remove the user with ID 1 and assign all posts and pages (including media and custom post types) to the new user. Remove the line from functions.php after running it. Remember to back up your WordPress database before running the queries.

Subscribe to getButterfly Blog

Once a week or so we send an email with our best content. We never bug you, we just send you our latest piece of content.

If you found any value in this post, agree, disagree, or have anything to add - please do. I use comments as my #1 signal for what to write about. Read our comment policy before commenting! Comments such as "Thank you!", "Awesome!", "You're the man!" are either marked as spam or stripped from URL.

Leave a reply