Skip to content

How to tell if your WordPress site is actually hacked or just flagged

By William · · updated · 6 min read

A closed laptop on a desk next to paper files and a pen, representing website maintenance
AI-generated image.

A real hack leaves a trace you can find in five places: a redirect in your .htaccess or theme files, an unknown admin user, injected code in the database, a new file you did not upload, or a Google Security Console warning with a specific URL. A false flag leaves none of these. Check those five before you pay anyone.

Key takeaways

  • If you find none of the five traces, the flag is likely a false positive or a plugin conflict, and the fix is usually a rollback or a support ticket.
  • Check the files before you check the database by downloading a full site backup and looking for RewriteRule or Redirect lines you do not recognise.

The five traces a real hack leaves

  • A redirect rule in .htaccess or a theme file pointing to a domain you do not recognise.
  • An admin or editor user in wp_users you did not create, with a creation date after your last login.
  • Injected JavaScript or iframes in the database, usually in wp_posts or wp_options.
  • A file in wp-content or wp-includes you did not upload, often with a random name.
  • A Google Search Console security alert naming a specific URL, not a generic "site flagged" email. This is a general observation of how such alerts typically appear, not a documented specification from Google.

If you find one or more of these, you have a real compromise. If you find none, the flag is likely a false positive or a plugin conflict.

What a false-positive flag looks like

  • Google Search Console shows a "manual action" or "security issue" with no redirect, no new files, and no unknown users.
  • A plugin update broke a shortcode and the browser shows a broken layout that looks like a warning.
  • Your host sent a generic "suspicious activity" email but the site loads normally and no redirect fires.
  • The flag appeared the same day you installed or updated a plugin; rolling it back clears the warning.

If your site matches any of these patterns and you find none of the five traces above, the fix is usually a 20-minute rollback or a support ticket, not a full cleanup.

Check the files before you check the database

  1. Download a full site backup via FTP or your host's file manager before touching anything.
  2. Open .htaccess in the root and in wp-content/themes/your-active-theme/ and look for RewriteRule or Redirect lines you do not recognise.
  3. List the files in wp-content/themes/your-active-theme/ and compare against the theme's original file list. Because themes are designed to change look and functionality without altering core code, a new .php file in the theme folder that is not part of the original theme is a strong sign of injection.
  4. Check wp-includes/ for any .php file with a name that is not a standard WordPress file.

Worked example: Suppose your site is on a $35/month managed host. You download the backup, open .htaccess, and find a line: Redirect 301 / https://unknown-domain.xyz. You delete that line, save the file, and upload it back. The redirect stops. You then check the theme folder and find a file named a8f3k2.php that was not in the original theme. You delete it. You have found two traces.

Check the database for injected code

  1. Export wp_posts and wp_options via phpMyAdmin or your host's database tool.
  2. Search wp_posts for <script, iframe, eval(, and base64_decode in the post_content and post_content_filtered columns.
  3. Search wp_options for the same strings in option_value, especially in the "widget" and "theme_mod" rows.
  4. If you find injected code, note the post ID and option name; that is the exact location a fixer needs.

Worked example: Suppose you search wp_posts and find base64_decode in post ID 142. You note "post ID 142, post_content column." You then search wp_options and find <script> in the option_value of the "widget_text" row. You note "option: widget_text." You now have two database locations to clean.

Check for unknown users and recent logins

  1. Go to Users > All Users in wp-admin and look for any account you did not create.
  2. Note the creation date and last login IP for each unknown account. A forgotten test account or a misconfigured plugin can create a user without a breach, so verify before assuming a hack.
  3. Check the security log (if you have a plugin like Wordfence or Sucuri) for login attempts from IPs you do not recognise.
  4. If you find an unknown admin, delete it and change every other admin password before you do anything else.

Worked example: Suppose you find a user "admin2" created on 12 March, with a last login IP from a country you have never done business in. You delete the user, change your own admin password, and enable two-factor authentication. You then check the security log and find 14 failed login attempts from that IP over the past week. That confirms a real compromise.

When to call a fixer and what to hand them

Call a fixer if the five checks above show a real compromise and you cannot clean it yourself, or if the site is already suspended and you need it back online today.

Hand them the exact file paths, database rows, and user records you found in the checks above. That cuts their diagnostic time and cost.

Ask for a written scope, price, and turnaround before any chargeable work starts. A reputable repair service will offer this.

If the site is on WordPress.com, the platform includes site recovery as a feature of its service [1], so open a support ticket there first before paying an external fixer.

If you need a structured checklist to walk through this process yourself or to brief a fixer, see the WordPress Hack Recovery Guide pack.

Harden against reinfection after the cleanup

  1. Update WordPress core, every plugin, and the active theme to the latest version before you take the site back online.
  2. Delete any plugin or theme you no longer use; unused code is a standing backdoor.
  3. Set file permissions to 644 for files and 755 for folders, and make wp-config.php readable only by the web server.
  4. Enable two-factor authentication on every admin account and use a unique password per site.
  5. If you reinfected before, that is the tell-tale sign of a backdoor that was never found, so run the five checks again after the cleanup and keep a clean backup dated after the fix.
Illustration: Harden against reinfection after the cleanup

What this checklist does not cover

  • It does not cover server-level compromise where the attacker has access to your host's other sites; that needs your host's security team.
  • It does not cover a compromised domain registrar account or DNS hijacking; check your registrar's login history separately.
  • It does not cover a site that was never backed up; if you have no pre-hack backup, the cleanup may require a full rebuild, which is a different cost and timeline.

Frequently asked questions

What are the five traces of a real WordPress hack?

A redirect rule in .htaccess or a theme file, an unknown admin user, injected JavaScript or iframes in the database, a file in wp-content or wp-includes you did not upload, or a Google Search Console security alert naming a specific URL.

How do I know if a flag is a false positive?

If Google Search Console shows a manual action with no redirect, no new files, and no unknown users, or if a plugin update broke a shortcode, the flag is likely a false positive.

When should I call a professional fixer?

Call a fixer if the five checks show a real compromise and you cannot clean it yourself, or if the site is already suspended and you need it back online today.

Sources

  1. wordpress.com

Related on this site

This article was drafted with AI assistance and checked before publication.

Free calculator: Website hack downtime cost calculator

The full guide: WordPress Hack Recovery Checklist

Free sample: WordPress Hack Recovery Checklist
Get the free sample now, and new guides by e-mail.