This is the checklist we used on a real hacked WordPress site last month. You can read what happened on that site here. Everything below is safe to run: these commands only look. Nothing gets changed or deleted.
You’ll need two things:
- cPanel access for your hosting account.
- cPanel’s Terminal. Search for “Terminal” inside cPanel. If you can’t find it, ask your host to turn on SSH or Terminal access.
Each step has a command with a copy button, then what a normal result looks like and what should worry you. Take your time. If something looks wrong and you’d rather not go further, send us the site and we’ll take it from there.
Before you start
Go to your website’s folder and check whether WP-CLI, WordPress’s command-line tool, is available. Most cPanel hosts have it.
cd ~/public_html
wp --info
If you see version details, you’re set. If you see “command not found”, the wp commands below won’t work, but the find and grep ones will. If your site lives in a different folder, use that folder instead of public_html.
1. Make a backup first
Even though these checks don’t change anything, you’ll want a copy of the site exactly as it is now, in case you need evidence later.
mkdir -p ~/incident
tar -czf ~/incident/files-$(date +%F).tar.gz -C ~/public_html .
wp db export ~/incident/database-$(date +%F).sql
This saves the files and the database into a folder called incident in your home folder, outside the website.
2. Check WordPress’s own files against the official copy
WordPress publishes a fingerprint (a checksum) for every core file. This compares yours against them.
wp core verify-checksums
Normal: “Success: WordPress installation verifies against checksums.”
Worrying: any line that says a file “doesn’t verify against checksum” or “should not exist”. Someone changed or added that file.
3. Check your plugins the same way
wp plugin verify-checksums --all
Normal: “Verified” for each plugin.
Worrying: changed or extra files in a plugin. Paid plugins can’t be checked this way and will show as skipped. That’s expected.
4. List every administrator
wp user list --role=administrator --fields=ID,user_login,user_email,user_registered
Worrying: an admin you don’t recognise, an admin created recently that nobody on your team made, or an old admin account nobody uses anymore. On the site we cleaned, the attackers both used an old admin and created a new one called something official-sounding.
5. See who is logged in right now
Pick any admin name from step 4 and replace USERNAME:
wp user session list USERNAME --fields=login_time,expiration
Worrying: sessions for an account nobody on your team is using, or several active sessions at once. Your security plugin may also show the IP address of each login.
6. Check whether anyone can sign up
wp option get users_can_register
wp option get default_role
Normal for most business sites: 0 (sign-up is off), and subscriber.
Worrying: 1 with a default role of contributor, author, editor or worse. Open sign-up fills your site with junk accounts and gives attackers a foothold.
Where hackers usually hide things
The next five checks look in these places. Red is almost always a bad sign. Amber needs a closer look.
7. Find PHP files changed recently
This lists PHP files changed in the last 30 days, newest first.
find . -name "*.php" -mtime -30 -printf '%TY-%Tm-%Td %TH:%TM %p\n' | sort -r | head -50
Normal: files from plugins you updated recently.
Worrying: changes on a day nobody updated anything, or files with odd names. Note the dates. They tell you when the attack started.
8. Look for PHP files in the uploads folder
The uploads folder is for images and documents. It should almost never contain PHP code.
find wp-content/uploads -name "*.php"
Normal: nothing, or a few index.php files.
Worrying: anything else. This is one of the most common places to hide a backdoor. We list the other seven places backdoors hide in Part 4.
9. Look for plugins and themes you never installed
ls -la wp-content/plugins wp-content/themes wp-content/mu-plugins 2>/dev/null
Worrying: names you don’t recognise, especially ones that end in a long number, like seo_1794290843 or error_404_1794290907. Those were real names on the site we cleaned. Also look out for file managers and code consoles you didn’t install.
10. Search for code that hides what it does
Attackers often scramble their code so it’s hard to read. This looks for the usual tricks.
grep -rlE "eval\(base64_decode|gzinflate\(base64_decode|str_rot13\(|eval\(\\\$_(POST|GET|REQUEST)|assert\(\\\$_" --include="*.php" . | head -30
Normal: nothing, or a few well-known plugins that use these legitimately.
Worrying: matches in your theme, in uploads, or in a plugin you don’t recognise. Open the file in cPanel’s File Manager and look. If the top of the file is one long line of random letters, it’s almost certainly malicious.
11. Check for odd files in the main folder
cd ~/public_html
ls *.php | grep -vxE "(index|wp-activate|wp-blog-header|wp-comments-post|wp-config|wp-config-sample|wp-cron|wp-links-opml|wp-load|wp-login|wp-mail|wp-settings|wp-signup|wp-trackback|xmlrpc)\.php"
find . -name ".htaccess" -printf '%TY-%Tm-%Td %TH:%TM %p\n' | sort -r
ls ~/public_html/google*.html 2>/dev/null
Normal: the first command prints nothing. Every PHP file in the main folder is on WordPress’s standard list.
Worrying:
- Any file the first command prints, especially look-alike names such as
wp-logiin.php. We found exactly that. .htaccessfiles in many folders, changed on the same day. Attackers use them to block or allow specific files.google....htmlfiles you didn’t add. Attackers use them to claim your site in Google Search Console, usually to push spam pages.
12. Read the logins in the access log
On cPanel, raw access logs are usually in ~/access-logs/. This counts which IP addresses logged in most:
ls ~/access-logs/
grep -h "POST /wp-login.php" ~/access-logs/* | awk '{print $1}' | sort | uniq -c | sort -rn | head -20
And this shows every plugin or theme upload:
grep -hE "action=upload-(plugin|theme)" ~/access-logs/* | awk '{print $1, $4}'
Worrying: lots of logins from many unrelated countries, or uploads at times nobody on your team was working. If an upload lines up to the minute with a new file from step 7, you’ve found how they got in.
13. Check for ways back in
Attackers like to leave a second door open. These look for scheduled jobs and SSH keys.
crontab -l
wp cron event list --fields=hook,next_run_relative
cat ~/.ssh/authorized_keys 2>/dev/null
Worrying: a cron job that downloads or runs something you don’t recognise, a WordPress scheduled event with a strange name, or an SSH key nobody on your team added.
What your results mean
- Everything came back clean: good news. Your problem is more likely a plugin, theme or PHP version clash. See why WordPress sites go down without being hacked.
- One or two odd results: don’t panic, but don’t ignore them. Keep the backup from step 1 and look closer, or ask us.
- An unknown admin, changed core files, or PHP in uploads: treat it as hacked. Don’t just restore a backup. Follow the clean-up steps. If the attackers have a password, a restore won’t keep them out.
Next: how to clean a hacked WordPress site, in the right order.
Prefer not to do this yourself?
That’s a completely reasonable call. Each of these checks takes a few minutes, but reading the results takes experience, and one wrong delete can take the site down. Send us the site and we’ll run all of this, clean it up, and tell you in plain words what happened. If you’d like it watched from now on, that’s what our care plans are for.
Sources
- WordPress developer docs: wp core verify-checksums
- WordPress developer docs: wp plugin verify-checksums
- WordPress developer docs: wp user session list
- WordPress.org: FAQ, my site was hacked
Common questions
How can I tell if my WordPress site has been hacked?
Look for admin accounts you didn't create, WordPress files that don't match the official checksums, PHP files inside the uploads folder, plugins or themes you never installed, and logins from unfamiliar IP addresses. The commands in this guide check all of these.
Do I need WP-CLI to check my site?
It makes it much faster, and most cPanel hosts already have it. Type wp --info in the Terminal to see. If it isn't there, the find and grep commands in this guide still work, and your host can usually turn WP-CLI on.
Should I delete suspicious files right away?
No. Make a full backup first, then move suspicious files to a folder outside your website instead of deleting them. You may need them as evidence, or to undo a mistake.
Where is cPanel's Terminal?
In cPanel, search for Terminal, or look under the Advanced section. Some hosts call it SSH Access or turn it off by default, in which case their support team can enable it for you.




