How to Change Your WordPress Admin Username
How to Change Your WordPress Admin Username
One of the simplest ways to help protect your site from would-be hackers is to choose a custom name for your WordPress admin or super admin account.
Hackers will have a difficult time injecting their way into your account with post requests to your wp-login.php page if they can’t guess your username. This creates an extra step for them since they won’t just have to guess your password.
What if you didn’t change your admin username when you originally created your site or network? In this Weekend WordPress Project I’ll show you how to change your default username for both single and Multisite installs through making a small change to your database.
Finding Your Database Name
Since we need to make slight changes to your database, you will need to know what it’s called in order to figure out which one to edit. You can do this by checking your wp-config.php file in the root of your WordPress files.
In cPanel, select the File Manager button under the Files section. If the File Manager Directory Selection pop-up appears, select the Web Root option or the Document Root for your site in the drop down list.
Select the wp-config.php file and click the Edit button at the top of the page. Look for the code similar to the example below:
Your database name will be listed on line three of this example where
your_db is written. Once you know your database’s name you can go ahead and change its tables.
Single WordPress Installations
In cPanel, click the phpMyAdmin button under Databases on the homepage. Select your database from the list on the left. Next, locate the
Click on it and find your admin username on the list.
Click the Edit button to insert values into the table option. Type in a new username in each of the fields where it’s displayed.
At the very least, you need to edit the
user_login field to change your username. If you would like to also change how your name is displayed on your site’s front end, change the
user_nicename field is the slug that will appear in the URL for places like the author archive page. What you enter here should not include spaces.
It’s usually the same as your login username, but in cases where your username doesn’t look so user friendly like “HeartPrintedUnderpants23,” you can choose a different name to appear as the slug.
When you’re done, save the changes you have made.
At the bottom of the table options, you’ll see a set of drop down boxes. Set the first one to Save and the second to Go back to previous page, then click Go to save your changes.
1.6 million WordPress Superheroes read and trust our blog. Join them and get daily posts delivered to your inbox - free!
Once you’ve made these changes, you’re done and you can now use your new custom username to log in. If you’re using Multisite, there are a few more steps you need to complete.
To change your super admin username for your network, first complete the steps above. Once you’re done, go back to your database tables list and find the
Click on it to reveal all its table options. When they load, look under the
meta_key column for the
Click the Edit button on the left of that row. Next, change the values for your admin username in the
There are two things you need to change. The first is your username. The second is the value for the character count of your username.
In the above example, the default username is shown and you would need to change admin and the number five which is displayed before the name. Since the username has five characters, the number five is listed before it.
This number may be different for you if your username is longer than five characters. The
meta_value may also look different if you have other permissions attached to your admin account. If this is the case, just look for the same values among the code.
If you wanted to change your username to “HeartPrintedUnderpants23,” for example, you would change the values to look like this:
Admin has been changed to the new username and the number “five” has been changed to “24” to reflect the number of characters in the new username.
Once you’re happy with your new username, click Go at the bottom to save the changes you made.
If you’ve followed along then you have successfully changed your default username to a custom one by making a few small tweaks to your database.
You have also made it a bit more difficult for hackers to get into your site, but this isn’t the only change you should make to increase the security of your site.
If you would like more ways to make your site or network safer, check out our posts Limit Access to the WordPress Login Page to Specific IP Addresses, WordPress Security Essentials: Obscurity Tactics and Backups and WordPress Security Essentials : Building A Layered Defense to name only a few.
You can find even more helpful posts by entering the term “security” into the search box on our blog.
If you would like an alternative that doesn’t require making changes to your database, there is another option. You could create a new user and select administrator permissions for it. Finally, you can delete the original admin user.
Just be aware that some plugins require additional permissions that cannot be selected when you create a new administrator account. That’s why changing your username in your database as we’ve covered in this post is often a better solution.
What is your favorite option for changing your admin username? Did you try changing it? Join the conversation and share your experience in the comments below.