Confirm the patch is actually running
BASH
wp core version
wp core verify-checksums
wp user list --role=administrator --fields=ID,user_login,user_email,user_registeredwp core verify-checksums compares core files against the official checksums from wordpress.org and reports files that were changed. It does not look inside wp-content. A clean result here tells you core is intact. It says nothing about plugins, themes, or uploads.
Treat the user_registered column with suspicion. An attacker who can write to the database can set any date, so a rogue admin can look like it was created years ago.
WP-CLI also has a limitation here. It boots WordPress to run most commands, which means it loads the site's code, including whatever the attacker added. Code can hook into user queries and hide accounts from both the Users screen and wp user list. Adding --skip-plugins --skip-themes reduces how much code runs, but must-use plugins (covered below) still load. If you suspect hidden accounts, query the database directly for anyone holding the administrator capability:
BASH
wp db prefix
wp db query "SELECT user_id, meta_key, meta_value FROM wp_usermeta WHERE meta_key LIKE '%capabilities' AND meta_value LIKE '%administrator%'" --skip-plugins --skip-themeswp_ with your actual prefix. If this query returns more user IDs than the admin list in the dashboard, something is filtering the list. That alone confirms code-level persistence.
Rule out causes that are not backdoors
wp option get users_can_register and wp option get default_role. If registration is open and the default role is administrator, anyone can sign up as an admin through the normal registration form. An attacker who had access once can flip these two options and walk away with no files left behind. When this is the cause, the access logs usually show requests to wp-login.php?action=register shortly before each new account appears.
The second is a database that keeps getting overwritten. A staging sync, a migration plugin, or a scheduled restore from a backup taken before the cleanup will put the deleted account straight back. If new admins appear at the same time a sync or restore job runs, start there.
The third is another person with admin access. A developer or agency account whose password leaked can create users as easily as an attacker can. Brute force against wp-login.php or xmlrpc.php does not create accounts by itself. If it succeeds against an existing admin, though, that admin can create more. Check whether each legitimate admin recognizes their own recent logins.
If none of these fit, assume the account is being recreated by code.
Find the code that recreates access
wp_insert_user(), wp_create_user(), or a direct SQL insert, either on every page load or on a schedule. That narrows the search to a few places.
BASH
ls -la wp-content/mu-plugins/
wp cron event list --fields=hook,next_run_relative,recurrence --skip-plugins --skip-themes
crontab -lwp-content/mu-plugins/ that WordPress loads on every request, before regular plugins. They cannot be deactivated from the dashboard and only appear under a separate "Must-Use" tab, which many people never open. This makes them a popular spot for persistence. Many sites have this directory empty or missing. If yours has files, find out which host tool, caching layer, or developer put each one there. If nobody can account for a file, read it.
WP-Cron events are the second place to check. A scheduled hook is only a name stored in the database. It does nothing unless some code registers a callback for it. So an unfamiliar hook in wp cron event list tells you two things: something scheduled it, and code somewhere is waiting to run when it fires. Look for hook names that match no installed plugin, or that imitate core naming with small differences.
The server crontab comes next. A line that runs curl or wget against a PHP file inside the site, or one that downloads and runs a script, can rewrite files or recreate users from outside WordPress entirely. On control panels, the crontab for the hosting account is usually visible both in the panel's cron screen and through crontab -l as that user.
Modified theme and plugin files are the last place, and the most common. The usual target is the active theme's functions.php, along with webshells dropped in wp-content/uploads/. That directory should normally contain no PHP files at all.
BASH
find wp-content/uploads -name '*.php' -ls
find wp-content -name '*.php' -mtime -30 -ls
grep -rnE 'wp_create_user|wp_insert_user|set_role|eval\(|base64_decode|gzinflate' wp-content --include='*.php'
wp plugin verify-checksums --allfind command is only an illustrative example. Adjust it to the period when the site was exposed, and keep in mind that modification times are easy to fake. For plugins outside wordpress.org and for themes, download a clean copy of the same version and diff it against what is on disk.
If you already reinstalled core and expected that to fix things, this is the gap. Reinstalling core leaves wp-content untouched, and wp-content is where most of this lives.
Remove it in the right order
wp-config.php. Remove access in this sequence:
- Take a copy before changing anything. Run
wp db exportand archive the files. You need this as evidence and as a rollback point. Restrict access to the site during cleanup if you can. - Remove the code persistence. Delete unexplained mu-plugins, PHP files in uploads, and injected code in themes. Replace wordpress.org plugins with fresh copies. Remove plugins nobody installed. Delete malicious entries from the server crontab.
- Clear the rogue scheduled events. Use
wp cron event delete <hook>for each hook you identified. Their callbacks are gone after step 2, but stale events clutter the next review. - Fix the registration settings. Set
users_can_registerback to 0 anddefault_roletosubscriber, unless you genuinely need open registration. - Delete the rogue users. Use
wp user delete <id> --reassign=<legit-admin-id>so any content they own moves to a real account. This cannot be undone. Double-check every ID against the database query from earlier before you run it. - Rotate every credential. Change all admin passwords, the database password in
wp-config.php(and in the database server itself), and the FTP, SSH, and control panel passwords. Then regenerate the authentication salts withwp config shuffle-salts. New salts invalidate every existing login cookie, including any session the attacker still holds.
Verify that it stays clean
mu-plugins listing regularly, and repeat the uploads find.
The access logs show how the attacker got in and whether they are still trying. Patchstack's write-up on post-patch probing recommends reviewing server and WAF logs for suspicious POST requests and path-traversal strings from just before you applied the patch. If you then see POST requests to PHP files that should not exist, searching POST requests to upload endpoints shows how to trace where a webshell came from.
If an admin reappears even after all of this, look beyond the single site. On hosting accounts with several WordPress installs running as the same system user, one infected install can write into all the others. Support engineers usually ask about other sites on the account early, because owners tend to clean only the site that showed symptoms.
The patch closes the door the attacker used to get in. Deleting the account only removes what you can see. The fix that holds is to find the code that recreates access, remove it, and only then delete the users and rotate credentials. If you do it in a different order, you will likely be deleting the same account again next week.