You're seeing Seahawk's original 2015 colors and logo. Thousands of WordPress sites maintained since.

Book a call Free rebuild
Home/Security/WordPress Hacked? How to Fix a Hacked WordPress Site
Guide

WordPress Hacked? How to Fix a Hacked WordPress Site

Published May 19, 2026 9 min read

If your WordPress site has been hacked, you can usually fix it yourself in an afternoon if the infection is simple, and you need to move quickly either way. Every hour the site stays infected, it can send visitors to scams, collect a Google warning, or get your hosting account suspended.

This guide walks through the same recovery order a professional cleanup follows: confirm the hack, contain it, clean files and the database, remove backdoors, close the way in, and clear the warnings.

Need it fixed now? If the site takes payments, handles customer data, or has already been reinfected once, skip the DIY route. Our WordPress hacked site repair service cleans the infection, removes blocklist warnings, and hardens the site, from $237 as a one-off, or included in WP Care Pro and above.

Signs your WordPress site has been hacked

Some hacks are obvious. Others are built to stay hidden from you while showing spam to search engines and visitors. Look for any of these:

  • Browser or Google warnings. Chrome shows a red "Dangerous site" or "Deceptive site ahead" page, or Google search results label the site as possibly hacked.
  • Redirects you did not set up. Visitors, often only those arriving from Google or on mobile, are sent to another site. You may not see it when you visit directly while logged in.
  • Spam pages and keywords. Search Console shows queries for pharmacy, gambling, or counterfeit goods, or a site: search shows pages you never published.
  • Changed content. A defaced homepage, unfamiliar links in the footer, or pop-up ads you did not add.
  • Locked out or new users. Your admin login no longer works, or administrator accounts appear that nobody on your team created.
  • Hosting suspension or a sudden slowdown. Your host disables the account for malware or abuse, or the server is overloaded by scripts running in the background.
  • Security plugin turned off. Attackers often disable scanners so they can work unnoticed.

Check Google Search Console first. The Security Issues report lists what Google found and gives you sample URLs, which tells you where to start looking.

Before you start: contain the damage

Do not start deleting files at random. A panicked cleanup can break the site and destroy the evidence you need to find the entry point. Work through these first.

  1. Stay calm and write down a timeline. When did you first notice something wrong? What changed recently: a new plugin, a theme update, a new person with access? That timeline usually points to the cause.
  2. Take a full copy of the infected site. Download all files and export the database, even though they are infected. Label it clearly so nobody restores it by mistake. It is your safety net and your evidence.
  3. Put the site into maintenance mode or restrict access. If it is serving malware to visitors, take it offline from your hosting panel or password-protect the site folder while you work.
  4. Scan your own computer. If an attacker stole your password through malware on your laptop, changing it from the same machine hands them the new one. Run an up-to-date antivirus scan first.
  5. Change the hosting password first. Then change SFTP, database, and WordPress passwords. Use a password manager and a unique password for each.
  6. Gather your access. You will need your WordPress admin login, hosting panel, SFTP credentials, database access, any backups with their dates, and your server access and error logs. Ask your host to turn logs on if they are off.

How to fix a hacked WordPress site, step by step

Step 1: Decide whether to restore or clean

If you have a backup from before the infection started, restoring it is usually quicker than cleaning, but only if you know when the hack began. Restore a backup taken after the infection and the malware comes back with it. Restoring also loses anything added since the backup: posts, form entries, and orders. If you are not sure, clean the site in place and use the backup only as a reference for what the clean files should look like.

Step 2: Scan every file

Run a server-side scan with a reputable WordPress security plugin, then a second scanner for a second opinion. If your host has a malware scanner in the control panel, run that too. Scan the whole hosting account, not only the WordPress folder: other sites in the same account can reinfect yours.

If you have WP-CLI access, the command wp core verify-checksums compares every core file against the official WordPress release and lists anything modified or added. wp plugin verify-checksums --all does the same for plugins from WordPress.org.

Step 3: Replace WordPress core, plugins, and themes

Do not try to edit infected core files line by line. Replace the wp-admin and wp-includes folders with fresh copies of the same WordPress version from WordPress.org, and replace the root files except wp-config.php. Reinstall every plugin and theme from its official source. Delete any you do not use, and delete any "nulled" premium plugin or theme downloaded from an unofficial site: they are a common source of infections.

Step 4: Clean the database

Attackers inject code into the database because file scanners miss it. Back up the database, then check these places:

  • wp_options: confirm siteurl and home point to your own domain, and look for unfamiliar entries containing script tags or long encoded strings.
  • wp_posts: search post content for script tags, iframes, and links to domains you do not recognize.
  • wp_users and wp_usermeta: remove administrator accounts nobody created. Check for accounts that have the administrator role but are hidden from the Users screen.
  • Widgets and theme settings: spam links are often stored here, because they appear on every page.

Step 5: Hunt down backdoors

A backdoor is a small piece of code that lets the attacker back in after you clean up. A site that gets reinfected within days almost always still has one. Check:

  • wp-content/uploads for any PHP file. Uploads should contain media, not code.
  • wp-content/mu-plugins for must-use plugins you did not install. They load automatically and do not appear on the normal Plugins screen.
  • Your theme's functions.php, header.php, and footer.php for code you did not write.
  • wp-config.php for extra include lines, and .htaccess files in every folder for redirect rules you did not add.
  • Scheduled tasks, both WordPress cron events and server cron jobs, that download or recreate files.

Common signs of hidden code include eval, base64_decode, gzinflate, and str_rot13 in places they do not belong. Some legitimate plugins use these too, so compare against a clean copy before deleting.

Step 6: Reset credentials and security keys

Change every password again now that the site is clean, and remove any user who no longer needs access. Then generate new security keys and salts with the WordPress.org key generator and replace the eight lines in wp-config.php. This signs out every logged-in session, including any the attacker still holds. Also regenerate API keys stored on the site, such as payment, email, or SMTP keys.

Step 7: Update everything and close the entry point

Update WordPress core, every plugin, and every theme. Check that your hosting runs a currently supported PHP version. Then look at your access logs around the time the hack began: requests to an unusual plugin file, or a burst of login attempts followed by a successful one, usually show how the attacker got in. If a plugin is abandoned and has no fix, replace it.

Step 8: Clear the warnings

Google does not lift a warning on its own after you clean up. In Search Console, open Security Issues, confirm you have fixed every issue listed, and choose Request Review with a short note on what you did. Google's Security Issues documentation explains the process; review times vary by issue type, so expect to wait. If your host suspended the account, send them your cleanup notes and ask for a rescan. Some security vendors keep their own blocklists, so check your domain with them too.

Step 9: Watch closely for two weeks

Rescan the site daily for the next couple of weeks. Watch for new admin users, changed files, and new pages in Search Console. If anything comes back, a backdoor was missed: go back to step 5.

How to keep your WordPress site from being hacked again

Most WordPress hacks start with software that was not updated, a reused or weak password, or an untrusted plugin. These habits close those doors:

  • Update on a schedule. Apply plugin, theme, and core updates promptly, and test them first on business-critical sites so an update does not break checkout.
  • Remove what you do not use. Every inactive plugin and theme is code an attacker can still reach.
  • Use two-factor login for administrators and give everyone else the lowest role that lets them do their job.
  • Use a web application firewall or virtual patching to block known exploits before a plugin update is available.
  • Keep daily off-site backups and test a restore now and then. A backup you have never restored is a guess.
  • Disable file editing in the dashboard by adding the DISALLOW_FILE_EDIT setting to wp-config.php, and block PHP from running in the uploads folder.
  • Turn off XML-RPC if you do not use the mobile app or remote publishing, and limit login attempts.

Our WordPress maintenance checklist turns these into a weekly and monthly routine.

When to call in a professional

DIY cleanup works for a simple infection on a site you know well. Bring in help when:

  • The site was reinfected after you cleaned it.
  • It takes payments or stores customer data, where a missed backdoor has real consequences.
  • You are locked out, or your host has suspended the account.
  • You are not comfortable working with files, the database, or SFTP.

Our hacked site repair service covers the full process above: scan, removal of malware and backdoors, core file repair, database cleanup, blocklist removal, hardening, and a written report. A one-off cleanup costs $237–$474, usually 3–6 Dev Hours. If you would rather not deal with this again, our WordPress security services add daily scans, virtual patching, tested updates, and backups through a WP Care plan.

Frequently asked questions

How do I know if my WordPress site is hacked?

The clearest signs are a browser or Google warning, visitors being redirected to other sites, spam pages or keywords in Search Console, administrator accounts nobody created, and a hosting suspension notice. Some hacks only show spam to search engines or mobile visitors, so check the Security Issues report in Google Search Console and run a site: search on Google.

Can I fix a hacked WordPress site myself?

Yes, if the infection is simple and you are comfortable with SFTP and the database. Follow the steps in order: copy the site, scan, replace core and plugins, clean the database, remove backdoors, reset keys, and update everything. If the site gets reinfected, takes payments, or you are locked out, a professional cleanup is safer.

Will restoring a backup fix a hacked site?

Only if the backup was taken before the infection began. Restore one made afterward and the malware returns with it. Restoring also loses content and orders added since the backup. After restoring, update everything right away and change all passwords, or the same weakness will let the attacker straight back in.

Why does my site keep getting hacked after I clean it?

Usually because a backdoor was missed, or the entry point was never closed. Check the uploads folder for PHP files, the mu-plugins folder, theme files, .htaccess, wp-config.php, and scheduled tasks. Then find and fix how the attacker got in: an outdated plugin, a reused password, or another infected site in the same hosting account.

How do I remove the Google warning from my site?

Clean the site fully first. Then open the Security Issues report in Google Search Console, confirm every listed issue is fixed, and request a review with a short description of what you did. Google lifts the warning once it confirms the site is clean. Review times vary by issue type, and a failed review means something was missed.

How much does it cost to fix a hacked WordPress site?

Doing it yourself costs your time and possibly a premium scanner. Our professional hacked site repair costs $237–$474 as a one-off, usually 3–6 Dev Hours, and is included in WP Care Pro and above. It covers malware and backdoor removal, database cleanup, blocklist review requests, hardening, and a written report.

WP Services

WordPress services at revolutionary pricing.

Productized WordPress services, from builds to care, delivered by Seahawk and tracked in one app. For the WordPress lovers.