Adminify Summer Sale

50%OFF

ENJOY SUMMER

Cool down your WordPress admin

00

Days

00

Hours

00

Min

00

Sec

Use Code:

SUMMERSALE
Flat 50% Off

How to change a WordPress username in 2026? (5 methods)

You created a WordPress account two years ago and called yourself "admin123". Now your client logs into the dashboard and sees that name on every comment, author byline, and password-reset email. You head to Users → Profile to fix it, and the Username field is grayed out with a tooltip that says "Usernames cannot be changed."

That is core WordPress behavior. The user_login column in the wp_users table is locked from the admin UI on purpose. There are five ways around it that actually work without breaking the site, and this guide walks through each one. The new WP Adminify Username Change module, a code snippet for functions.php, the phpMyAdmin route that works on any host, WP-CLI for people who live in the terminal, and the native WordPress create-and-delete dance for the cases where everything else is unavailable.

Why WordPress locks the username field

The user_login field is the primary identifier WordPress uses for login authentication. It also seeds entries in wp_usermeta, comment author records, post-author relationships, and any third party plugin that stores user references by login string instead of user ID.

If WordPress let anyone change a username from the profile screen, sites running a poorly coded plugin would silently break. Comments orphaned. ACF user-relationship fields lost. REST API tokens invalidated. Core takes the safe path and locks the field instead. The official Users Screen docs say "Username (cannot be changed)" right there.

The methods below all work because they update the same database column directly. They just wrap the change in safeguards: capability checks, username sanitization, session invalidation. That way you don't end up with broken auth and a panicked client.

[This feature is coming soon in WP Adminify. We took screenshot from our beta version. It will be available in WP Adminify within 1 or 2 upcoming release.]

Method 1: WP Adminify Username Change (recommended for most sites)

The fastest GUI route. WP Adminify v3.7+ ships a Username Change module under WP Adminify → Security → Users Security. Once it's on, every user edit screen gets a "Change" link beside the username field. Exactly where WordPress should have put it in 2010.

Step 1 - Enable the Username Change toggle

In your WordPress admin, go to WP Adminify → Security. Scroll to the Users Security row, switch it to Show, then toggle Username Change to Yes. The setting saves automatically.

WP Adminify Security panel with Users Security row expanded and Username Change toggle set to Yes

Step 2 - Open the user you want to rename

Go to Users → All Users. Click Edit under the user whose username you want to change. Scroll down to the Name section.

Step 3 - Click "Change" beside the username

You will now see a Change link beside the previously-locked Username field. Click it.

User edit screen showing the Change link beside the username and the new input field with Save Change button]

Step 4 - Type the new username and save

A new text input appears below the original username, plus a blue Save Change button. Type your desired username. WP Adminify validates it on save. It checks against existing usernames, runs WordPress's sanitize_user() rules (no spaces, restricted character set), and rejects anything that would conflict.

Type the new username and save

Click Save Change. The username updates instantly. If you changed your own username, WordPress logs you out and you'll need to log back in with the new username and your existing password (more on this in the "What happens right after" section).

Why this is the path I recommend first: WP Adminify handles the capability check (edit_users required), runs the change through wp_update_user() hooks so other plugins fire correctly, and updates session tokens so the affected user is properly logged out. You get the database accuracy of a manual SQL update without the orphan-data risk that comes from forgetting one of those steps.

Method 2: Add code to functions.php (developer-friendly, no plugin)

If you don't want to install a plugin just for one username change, drop this snippet into your active theme's functions.php. Or better, use a code snippets manager so it survives a theme switch and you can disable it with a toggle when you're done.

The snippet adds an admin-only handler that updates the user_login column directly when an authorized request hits it.

1
2<?php
3/**
4 * Change WordPress username via URL trigger.
5 * Admin-only. Use once, then remove.
6 *
7 * Trigger URL example:
8 * /wp-admin/?adminify_change_username=1&user_id=2&new_username=newname
9 */
10add_action( 'admin_init', 'adminify_change_username_handler' );
11function adminify_change_username_handler() {
12
13    // Only administrators can run this.
14    if ( ! current_user_can( 'edit_users' ) ) {
15        return;
16    }
17
18    // Bail if the trigger isn't present.
19    if ( empty( $_GET['adminify_change_username'] ) ) {
20        return;
21    }
22
23    $user_id      = isset( $_GET['user_id'] ) ? absint( $_GET['user_id'] ) : 0;
24    $new_username = isset( $_GET['new_username'] ) ? sanitize_user( wp_unslash( $_GET['new_username'] ), true ) : '';
25
26    if ( ! $user_id || empty( $new_username ) ) {
27        wp_die( 'Missing user_id or new_username.' );
28    }
29
30    if ( username_exists( $new_username ) ) {
31        wp_die( 'That username is already taken.' );
32    }
33
34    global $wpdb;
35    $updated = $wpdb->update(
36        $wpdb->users,
37        array( 'user_login' => $new_username ),
38        array( 'ID' => $user_id ),
39        array( '%s' ),
40        array( '%d' )
41    );
42
43    if ( false === $updated ) {
44        wp_die( 'Database update failed.' );
45    }
46
47    // Invalidate user session tokens so they're forced to log in again.
48    $sessions = WP_Session_Tokens::get_instance( $user_id );
49    $sessions->destroy_all();
50
51    wp_die(
52        sprintf(
53            'Username changed to %s. <a href="%s">Log in again</a>.',
54            esc_html( $new_username ),
55            esc_url( wp_login_url() )
56        )
57    );
58}
59

How to use it:

  1. Add the snippet to functions.php in your active theme, or use the code snippets manager in WP Adminify.
  2. While logged in as an administrator, visit:
    https://yoursite.com/wp-admin/?adminify_change_username=1&user_id=2&new_username=newname
  3. Replace 2 with the actual user ID and newname with the username you want.
  4. Remove the snippet right after the change. A username-change handler accessible via URL is a security risk, even with the capability check. Don't leave it in.

What this code does, line by line:

  • current_user_can( 'edit_users' ) blocks anyone who isn't an admin.
  • sanitize_user() with the strict flag strips invalid characters that would break login.
  • username_exists() stops a duplicate-username collision that would corrupt the users table.
  • $wpdb->update() on $wpdb->users runs a direct UPDATE on the user_login column with prepared placeholders.
  • WP_Session_Tokens::destroy_all() invalidates the affected user's sessions so they have to re-authenticate.

This is functionally what WP Adminify does behind the GUI button. Minus the validation UI, the audit log entry, and the protection against accidentally renaming the only admin out of dashboard access.

Method 3: Edit wp_users directly in phpMyAdmin

The database-level fallback. Works on any host with phpMyAdmin (cPanel, Plesk, most managed hosts). Use this when you can't log into WordPress at all. For example, if a previous admin locked you out of the dashboard or your only admin account is the one you're trying to rename and the GUI methods can't help.

Step 1 - Open phpMyAdmin and select the WordPress database

From your hosting control panel, open phpMyAdmin and click your WordPress database in the left sidebar. If you have multiple databases, the right one is referenced as DB_NAME in your wp-config.php file.

Step 2 - Open the wp_users table

Find the wp_users table. Your prefix may differ — check $table_prefix in wp-config.php. Click it to see the user list.

Step 3 - Edit the row

Click Edit beside the user you want to rename. Find the user_login field. Change it to your new username. Click Go at the bottom to save.

phpMyAdmin showing the wp_users row with user_login field highlighted for edit]

One thing not to touch: user_nicename. That is the URL-friendly version of the display name and WordPress regenerates it from the new username automatically when the user updates their profile next. Editing it manually here can desync the author archive slug.

SQL alternative for the terminal-friendly

If you have command-line MySQL access:

1
2UPDATE wp_users SET user_login = 'newname' WHERE ID = 2;
3

One line. Done. Replace wp_ with your actual table prefix, newname with the new username, and 2 with the user ID.

Method 4: WP-CLI command (one-liner)

If your host supports WP-CLI (most managed hosts do — Kinsta, WP Engine, Cloudways, SiteGround all bundle it), this is the quickest method.

1
2wp db query "UPDATE $(wp db prefix)users SET user_login='newname' WHERE ID=2;"
3

Or, if you prefer the safer wrapper that also runs WordPress hooks:

1
2wp user update 2 --user_login=newname
3

One thing to watch: wp user update doesn't always allow user_login changes on every WP-CLI version. If it errors, fall back to the raw SQL form above. Either way, follow up with:

1
2wp user session destroy 2 --all
3

That invalidates the renamed user's existing sessions so they have to log in again with the new username.

Method 5: Create a new user and delete the old one (native WP, zero code)

This is the route the WordPress.org documentation suggests because it doesn't touch the database directly. It is safe but slow, and it changes the user ID, which causes problems on sites where content is referenced by user ID.

Step 1 - Create the new user

Go to Users → Add New. Enter the new username, the same email as the old account (you'll need to temporarily change the old account's email to a placeholder first, since WordPress requires unique emails). Set the role to match the old user.

Step 2 - Log out of the old account

You can't delete the user you're currently logged in as. Log out and log back in as another administrator.

Step 3 - Delete the old user and reassign content

Go to Users → All Users. Hover over the old username and click Delete. WordPress will ask what to do with the user's content. Choose Attribute all content to and pick your new username from the dropdown.

Trade-offs to know about:

  • You lose the original user ID. Any plugin that stores data against user ID (like ACF user fields, Easy Digital Downloads order history, BuddyBoss profiles) needs to be migrated manually.
  • Comment authorship transfers, but custom meta tied to the old ID does not.
  • Email notification subscriptions usually need to be re-confirmed.

I'd only use this on a small site with no third party plugins that lean on user ID. For everything else, the first four methods are safer.

Comparison table: pick the right method

MethodDifficultyRiskBest forPreserves user ID?
1. WP Adminify Username ChangeEasy (GUI)LowMost sites - agencies, non-developers, multisiteYes
2. functions.php code snippetMediumMedium (URL-triggered, must be removed after)Developers, one-off changes, no plugin installYes
3. phpMyAdmin SQL editMediumMedium (one typo can corrupt the row)Locked out of admin, hosting-only accessYes
4. WP-CLI commandEasy (if CLI available)LowManaged hosts, server-savvy adminsYes
5. Create + delete (native WP)EasyHigh (loses user ID, breaks plugin meta)Small sites, no third party user-meta dependenciesNo

What happens right after you change a username

Most guides skip this part. Three things happen the moment user_login updates:

  1. If you changed your own username, you get logged out immediately. WordPress invalidates your session because the cookie is keyed against the old user_login. Log back in with the new username and your existing password. The password doesn't change.
  2. If you changed someone else's username, they get logged out the next time their cookie is validated. They'll see the login screen and need to use the new username.
  3. The author archive URL changes. If your author URL was yoursite.com/author/oldname/, it now becomes yoursite.com/author/newname/. The old URL returns 404. Set up a 301 redirect from the old slug to the new one if the page had backlinks or organic traffic.

What does not change:

  • The user ID stays the same (methods 1 through 4).
  • The display name (the public byline) stays the same unless you also update it.
  • The email address stays the same.
  • The password stays the same.
  • All user roles, capabilities, and meta stay the same.
  • Authored posts, comments, and media uploads stay attached to the same user.

Common issues and fixes

"Username already exists" error

WordPress requires unique usernames. Pick a different one or, if the duplicate is an old test account you don't need, delete that account first.

The change saved but I'm still seeing the old username on posts

The byline shown publicly is display_name, not user_login. Go to Users → Profile and update Display name publicly as to match your new preference.

I'm locked out after changing my own username

Use the new username with your existing password. If that fails, request a password reset. The reset link is sent to your email address, which didn't change. If you've also lost email access, follow the password reset guide via phpMyAdmin.

Author archive URL returns 404

The slug changed with the username. Either set up a 301 redirect (use your SEO plugin or the URL redirection feature), or manually update user_nicename in wp_users back to the old slug if SEO is the priority.

WooCommerce orders show "Guest" instead of the renamed customer

WooCommerce stores the customer reference by user ID, not username. So this shouldn't happen with methods 1 through 4. If you used method 5 (create + delete), the user ID changed and you'll need to manually reassign the orders to the new account from WooCommerce → Orders.

Multisite: which database table do I edit?

On Multisite, users are global. They live in the network-level wp_users table, not the per-subsite wp_2_users table. Edit the network table. The username change applies across every subsite the user has access to.

Question to change a WordPress Username

Can I change the WordPress admin username without a plugin?

Yes. Use phpMyAdmin to update the user_login column in the wp_users table, run a WP-CLI command, or drop the functions.php snippet from method 2 above. All three work without installing a plugin. WP Adminify is faster and safer for non-developers, but no plugin is technically required.

Will changing my WordPress username log me out?

Yes. If you change your own username, WordPress invalidates your session cookie immediately and redirects you to the login screen. Log back in with the new username and your existing password. Other users you rename get logged out the next time their session is validated.

Does changing the username also change my WordPress password?

No. Username and password are stored in separate columns (user_login and user_pass). Renaming the username has no effect on the password. The same password works after the change.

Will my posts and comments stay attached to my account after I change the username?

Yes, as long as you use methods 1 through 4 (which preserve the user ID). Posts, comments, and media uploads in WordPress are linked by user ID, not username, so the relationships survive the rename. Method 5 (create + delete) does not preserve the ID, which is why it's last on the list.

Can I change a username on WordPress Multisite?

Yes. Use any of methods 1 through 4 from the Network Admin. The change applies across every subsite the user has access to, since users on Multisite are stored in the network-level wp_users table. WP Adminify works the same way on Multisite as on a single site.

What characters are allowed in a WordPress username?

Letters, numbers, spaces, underscores, hyphens, periods, and the @ symbol. Spaces are technically allowed in user_login via sanitize_user() with the strict flag off, but most admins avoid them. WordPress automatically trims and lowercases the username on creation, but does not on direct database updates. That's why the WP Adminify and code methods both run sanitize_user() first.

Why does WordPress not let me change usernames from the profile screen?

WordPress core locks the username field because user_login is referenced by countless plugins, login cookies, and external integrations. Allowing arbitrary username changes from the profile UI would silently break sites where third party code stores user references by login string instead of user ID. The methods in this guide all wrap the change in safety checks (capability checks, session invalidation, duplicate detection) that the native profile screen would lack.

Is there a free plugin to change WordPress usernames?

Yes. The WP Adminify pro on WordPress.org includes the Username Change module from version 4.1.16+. Older alternatives include "Username Changer" and "Easy Username Updater". Both work but only handle the rename and don't bundle the rest of the admin customization stack.

Conclusion

Five methods, one job. Pick by use case:

  • Most sites: WP Adminify Username Change. GUI, safe, audit-logged.
  • One-off, no plugin: the functions.php snippet. Just remove it after the change.
  • Locked out of admin: phpMyAdmin SQL edit.
  • Server access available: WP-CLI one-liner.
  • Tiny site, no third party user data: create new user + delete old. Last resort.

Whichever method you pick, remember the post-change behavior. Changing your own username logs you out, the password stays the same, and the author archive URL updates. If you want the safest path plus 60+ other admin tools in the same plugin, turn on the Security module in WP Adminify.

Get notified about Updates & Offers

Subscribe to get Updates & Offers

You Might Also Like:

Leave a Comment

Your email address will not be published

Coupons