Hidden admin user in WordPress keeps coming back? Find the code that recreates it

An unknown WordPress admin keeps reappearing after you delete it? How to find hidden admin users, the code that recreates them, and the order to remove both.

By Hera Ahmad · · 8 min read

You found an administrator you never created. You deleted it. The next day it was back, or the user count says there are more admins than you can see. When that happens, code on your site is creating the account, and it will keep doing so until you remove the code.

This guide shows how to find a hidden admin, where the code that recreates it usually lives, and the order to remove both so it stays gone. If you would rather hand it over, our WordPress malware removal service does this as part of every cleanup.

Rogue admins turn up often. In Sucuri’s 2023 Hacked Website Report, 55.2% of the sites with database malware had at least one malicious WordPress administrator.

How to tell a hidden admin exists

Start with the Users screen. The links at the top show counts, such as “All (6) | Administrator (3)”. If the list below shows fewer rows than the count, something is filtering the list. Hiding code can adjust the count as well, so a matching count does not prove you are clean.

The reliable check is the database itself. First find your table prefix, because it is not always wp_:

wp db prefix

Then list every account with administrator rights. wp db query sends the SQL straight to MySQL, so no WordPress filter can change the answer. Replace wp_ with your prefix in both the table names and the meta_key:

wp db query "SELECT u.ID, u.user_login, u.user_email, u.user_registered
FROM wp_users u
JOIN wp_usermeta m ON m.user_id = u.ID
WHERE m.meta_key = 'wp_capabilities'
AND m.meta_value LIKE '%administrator%'
ORDER BY u.user_registered DESC;"

No WP-CLI? Run the same query in phpMyAdmin or your host’s database tool.

Now compare it with what WordPress reports:

wp user list --role=administrator --fields=ID,user_login,user_email,user_registered

If the SQL shows an account that wp user list does not, the hiding code is running. Note that --skip-plugins will not help here. The WP-CLI docs say that with that flag “mu-plugins are still loaded”, and mu-plugins are a favourite hiding place.

In the results, look for:

  • registration dates you cannot match to a person, especially around the time of the hack;
  • logins that sound like service or helper accounts (Sucuri has reported adminbackup and help) or are random strings;
  • email addresses on domains you do not use;
  • a wp_user_level of 10 in wp_usermeta, the legacy marker for an administrator, on an account that should not have it.

On multisite, also check super admins. They are stored in wp_sitemeta under the key site_admins, or you can run wp super-admin list, which loads WordPress and can be filtered in the same way.

Why deleting it doesn’t work

A hidden admin usually comes with two pieces of code. One hides the account from the Users screen. One way to do that is the pre_user_query hook, which WordPress fires “after the WP_User_Query has been parsed, and before the query is executed”. Code on that hook can edit the query so the attacker’s user drops out of the list. The other checks on every page load whether the account exists and, if not, creates it again. In a 2020 case Sucuri wrote up, code at the bottom of a theme’s functions.php ran on the init hook and called wp_create_user() to make the user, then gave it the administrator role.

So after you delete the user, the next page load runs the code and the account is back. Changing its password does nothing either. A fake “compatibility” plugin Sucuri found in 2025 reset the password of its adminbackup account, hid itself from the Plugins screen and changed the admin count so the numbers still matched. Another 2025 case used a fake core file in the site root, wp-user.php, that deleted and recreated a user called help with the attacker’s password.

Where the code that recreates it lives

Search for the functions that create users and hide them. Run this from the WordPress root:

grep -rnE "wp_create_user|wp_insert_user|pre_user_query|views_users" \
  wp-content/ *.php --include="*.php"

Expect some hits. WooCommerce, membership and form plugins create users legitimately. You are looking for calls in files that have no reason to make users, calls tied to a fixed username, or code that is obfuscated with base64_decode, gzinflate, str_rot13 or eval. Obfuscated code will not match the function names, so search for those too.

Then check these places in turn.

Must-use plugins

Anything in wp-content/mu-plugins/ runs on every request and does not appear in the normal Plugins list or as something you can deactivate. Many sites have nothing here at all. List the folder and open every file:

ls -la wp-content/mu-plugins/

Theme functions.php

Check the active theme and its parent theme. Read the whole file, including the end: in the 2020 Sucuri case the code sat at the bottom.

Fake core files in the site root

The *.php in the grep above covers the site root, where wp-user.php was hidden in the second 2025 case. Run wp core verify-checksums to find changed core files, then list the root yourself (ls -la) and look for wp-*.php names that a standard WordPress download does not include.

Fake or modified plugins

Compare the folders in wp-content/plugins/ with wp plugin list. A folder that WordPress does not list, or a plugin you never installed, needs a close look. For plugins from WordPress.org, wp plugin verify-checksums --all reports files that differ from the official copy.

Database options

Some malware keeps its code in wp_options and runs it from a small loader file. Search for code-like values:

wp db query "SELECT option_name, LENGTH(option_value) AS size
FROM wp_options
WHERE option_value LIKE '%wp_create_user%'
OR option_value LIKE '%base64_decode%'
OR option_value LIKE '%eval(%';"

Code snippet plugins also store their code in the database, so review every active snippet.

Scheduled tasks

A WordPress cron event can recreate the user hourly or daily, which is why it sometimes comes back the next day rather than straight away:

wp cron event list --fields=hook,next_run_relative,recurrence

Any hook name you cannot trace to a plugin or theme you use is suspect. Also check server cron (crontab -l, or the Cron Jobs page in cPanel or your host’s panel).

Other loaders

Loaders in .user.ini, .htaccess and drop-ins such as object-cache.php can also bring the code back. Our guide on why WordPress malware keeps coming back covers each of those.

Removing it in the right order

If you delete the user while the code still runs, it returns. If you change passwords while a backdoor is still logging them, you give the attacker the new ones.

  1. Back up. Export the database (wp db export) and copy the files, infected or not. You will need them to work out how the attacker got in.

  2. Remove the code. Delete the rogue mu-plugins, fake plugins, malicious options, snippets and cron events. Replace core, plugins and themes with clean copies from their official sources instead of editing infected files.

  3. Delete the user. Replace 1234 with the rogue user’s ID from your SQL check and 1 with your own user ID. The --reassign flag hands any posts to your account. Without it, the user’s content is deleted with the user:

    wp user delete 1234 --reassign=1
  4. Check the other admins. An attacker with admin access could also have added an application password to a real admin account, which works without the main password. Check each administrator, replacing 1 with their ID:

    wp user application-password list 1

    Delete any you did not create.

  5. End every session. This logs out every user, including any attacker who is still signed in:

    wp user list --field=ID | xargs -n 1 wp user session destroy --all
  6. Replace the security keys and salts in wp-config.php. This also invalidates login cookies:

    wp config shuffle-salts
  7. Change passwords last: every administrator, plus the hosting, FTP, SFTP and database accounts.

Checking it stays gone

Run the administrator SQL query again straight away, then after the site has had some traffic. Force any due cron events to run, then check once more:

wp cron event run --due-now

Repeat the check daily for at least two weeks. If the account comes back, something from the “where it lives” list is still there, or another site on the same hosting account is reinfecting this one.

Then find the way in. A vulnerable or abandoned plugin, a reused admin password or a nulled theme are the usual causes. Update everything, remove what you do not use and turn on two-factor authentication for every admin. To see what an attacker can learn about your site from outside, run our free WordPress security checker.

Get help if the user has come back after one careful cleanup, if several sites share the hosting account, or if the site takes payments. We remove hidden admins and the code behind them from $149 per site; see WordPress malware removal. If you also want someone to keep the site patched afterwards, you can hire a WordPress developer from our team.

Sources and further reading

Frequently asked questions

Why can't I see the admin in the Users screen?

Malware can hook into the query WordPress uses to list users and remove its own account from the results. The account is still in the database, so check the wp_users and wp_usermeta tables directly.

Is a user called "wordpress" or "wp-system" normal?

WordPress itself only creates the one account you set up at install. Some hosts and plugins add their own support accounts, so ask your host about any name you cannot explain. If nobody can account for it, treat it as hostile.

Will changing passwords stop it?

No. The account is created by code on your site, not by someone logging in. A new password does nothing while that code still runs, and some malware records the new password as you type it. Remove the code first, then change passwords.

Can a security plugin remove it?

It may flag the account or the file, but plugins run inside the same WordPress install as the malware and can be fooled by the same hiding code. They also rarely trace the cron job or database option that recreates the user. Check by hand as well.

Got a project? Let's build it.