On this page
Discovering that your site has been hacked is an alarming moment, but panic is the worst thing you can do. Deleting files at random, hastily restoring an old backup, or changing a single password and relaxing are all mistakes that prolong the disaster instead of ending it. A successful hack leaves more than one trace behind: code injected into legitimate files, hidden backdoors that reopen the way in, planted admin accounts, and scheduled tasks that re-plant the infection after every cleanup. Dealing with this requires an organized response plan that separates three distinct tasks: containing the damage, investigating its cause, then recovering and closing the hole. This reference guide takes you through these stages in the right order, with diagnostic tables, ready-to-use scanning commands and checklists. Read it through first to understand the logic, then use it as a work list to apply to your site step by step. And if your site is not infected yet, this is the best time to read it: prevention is far cheaper than cure.
How do you know your site has really been hacked?
Before any cleanup, you need to confirm that there is an infection and determine its nature. Some symptoms are explicit and unmistakable, while others are hidden and appear only under certain conditions, such as a redirect that shows up only for visitors coming from Google search results, not when you type the address directly. A skilled attacker deliberately uses this kind of camouflage so the site looks normal to its owner for as long as possible. That is why you should not rely on your own browsing alone; check from several angles: a private browser window without being logged in, a mobile device, and a search engine.
Common signs of infection
The following table links the main signs to what they usually mean, so you can read the symptoms quickly and direct your scan:
| Sign | What it usually means | Where to check |
|---|---|---|
| A browser warning: "Deceptive/dangerous site" | Listed by Google Safe Browsing | Open the site in Chrome/Firefox |
| A warning in Google Search Console | Malware or hacked content detected | The "Security issues" section |
| Redirects for search visitors only | An injected redirect conditional on the referrer | Visit via a search result |
| Strange spam pages or posts | Injected content (pharma, gambling, counterfeits) | A site: search on Google |
| Sudden slowness or high CPU load | Cryptomining or the server being used in an attack | The hosting panel/process monitoring |
| A message from your hosting provider | Malicious activity or outgoing spam detected | Your email + the hosting panel |
| Admin accounts you did not create | A backdoor with full privileges | The user list |
| Recently modified files you never touched | Injected code or a web shell | File manager/SSH |
| The site's email goes to spam for everyone | The server is being used to send spam + a blacklist | A send test + blacklist tools |
| Garbled Google search results for your address | Injection into page titles/descriptions | A site: search |
Confirming the infection before cleaning
Before you start, establish the facts. Record exactly what you saw: the symptom, when it first appeared and on which pages. Use a neutral external scanning tool (one that scans the site as a visitor sees it) to confirm an injection or a blocklist listing. Check Google Search Console and your Bing Webmaster account. And examine the access logs in your hosting for suspicious requests or an unusual spike. This documentation is not bureaucracy: the date of the first infection will determine which backup is still clean, and the request pattern may reveal the entry hole early on.
What types of malware infect websites?
Not all infections behave the same way. Understanding the type of malware determines where you look and how you clean. Some lives in the files, some in the database, and some spreads across both and re-plants itself through a scheduled task. The following table summarizes the most common types:
| Type | What it does | Where it usually hides |
|---|---|---|
| Code injection | Inserts malicious PHP/JS code into legitimate files | Theme headers, plugin files, functions.php |
| Backdoor | Reopens the attacker's access after cleanup | Files with misleading names, the uploads folder, wp-config |
| Malicious redirect | Sends the visitor to a fraudulent site | .htaccess, the theme header, the database |
| Ad/link injection (spam/SEO) | Injects hidden spam links or pages | The posts and options tables in the database |
| Phishing | Plants pages impersonating banks/services to steal data | Hidden subfolders inside the site |
| Cryptominer | Consumes server resources for hidden mining | Scheduled scripts, JS code on the front end |
| Card skimmer | Intercepts payment data on checkout pages | JS code on the checkout page/in the database |
| Web Shell | A full browser-based control interface for the server | A standalone PHP file with a random name |
The key difference between these types is that some are visible and annoying (page defacement, pop-up ads) while others are silent and profitable for the attacker (card skimming, mining, phishing). The silent ones are the most dangerous because they last longer, so don't settle for fixing what you can see; always assume there is an accompanying backdoor until proven otherwise, because backdoors are the number one reason a hack returns after a seemingly successful cleanup.
What are the response steps, in the right order?
The order is not a detail; it is the essence of success. Each step paves the way for the next, and doing one before another can undo all the work. The following table summarizes the complete sequence, and then we detail each stage in its own section:
| Order | Step | Goal | Common warning |
|---|---|---|---|
| 1 | Confirm and document the infection | Know its type and extent | Don't clean before you understand |
| 2 | Isolate the site (maintenance mode) | Stop the damage and protect visitors | Don't let it keep serving infected pages to visitors |
| 3 | Take a full backup as evidence | Preserve the state before making changes | Even the infected copy is useful for analysis |
| 4 | Full scan (files + DB + cron + .htaccess + users) | Identify every infected location | Don't stop at the files alone |
| 5 | Manual cleanup or a clean restore | Remove all malicious code | A clean restore is usually safer |
| 6 | Close the entry hole | Prevent a return through the same door | Without it, the hack recurs immediately |
| 7 | Reset all credentials and keys | Invalidate any stolen access | Thorough: WP, DB, hosting, FTP and salts |
| 8 | Get delisted by Google and blacklists | Restore trust and traffic | Only after confirming the site is fully clean |
| 9 | Harden to prevent a repeat | Raise the cost of the next hack | Security is a process, not a one-off task |
Steps 1–2: confirm, then isolate
Once the infection is confirmed, isolate the site immediately. Isolation serves two purposes: it prevents further damage (more planted files, spam being sent, visitors being infected), and it protects you from worsening blocklist listings. Put the site into maintenance mode or take it offline temporarily at the server level. If it is a commercial site, temporary isolation is cheaper than leaving an infected checkout page stealing your customers' cards. And if you are on shared hosting and your host notified you of the infection, coordinate with them, since isolating some paths may be necessary to protect the other accounts on the same server.
Step 3: take an evidence backup before any change
Before you delete a single character, take a full backup of the current state, files and database together, and store it in isolation, away from the clean backups. This infected copy is valuable: it reveals how the attacker got in and what they planted, allows comparison with a clean copy later, and helps if you need an expert or a legal report. Don't restore over it, and don't trust it as a working copy; treat it as evidence only. Name it clearly and include the date it was taken.
How do you scan your site thoroughly?
An incomplete scan is worse than no scan, because it gives you false reassurance. A single infection can spread across the files, the database and scheduled tasks at the same time, and cleaning one place while leaving another means an immediate return. Check all of the following places without exception.
Available scanning tools
A variety of tools reveals what a single tool misses. The following table compares the common categories:
| Tool/category | How it works | Especially good at detecting | Note |
|---|---|---|---|
| Sucuri SiteCheck | An external scan from the visitor's side | Visible injections and blocklist listings | Free, superficial (cannot see the files) |
| Wordfence Scan | An internal scan that compares against the original core files | File modifications and backdoors | Strong at detecting WordPress injections |
| MalCare / Imunify360 | A deep server-side scan + cleanup | Complex account-level infections | Usually through your hosting |
| VirusTotal | Scans a URL/file with dozens of engines | Confirms the reputation of a file or address | For confirmation, not a full scan |
| Server scan (SSH commands) | Manual search for suspicious patterns | What ready-made tools miss | Requires experience and caution |
| Google Search Console | The "Security issues" report | Google's view of the site | Where you request delisting later |
Common hiding places
Know the map of hiding places so you know where to direct your scan. The following table lists the recurring locations:
| Location | What is usually planted there | How to check |
|---|---|---|
| Modified core files | Injections into the original WordPress files | Compare with a clean copy of the same version |
The uploads folder wp-content/uploads | Malicious PHP files (which should not be there) | Search for any .php inside it |
functions.php and the theme header | Redirect code or ad injection | Check the beginning/end of the file |
The .htaccess file | Malicious redirect rules | Open it and review every line |
The database (wp_options, wp_posts) | Hidden links/scripts and redirects | Search the tables for suspicious patterns |
| Scheduled tasks (Cron / WP-Cron) | Re-planting the infection periodically | Review the scheduled tasks |
| Users | A planted admin account | Review the user list and roles |
| Standalone files with random names | A web shell or backdoor | Search for recent, unfamiliar files |
Scanning files for suspicious patterns
Over SSH, you can search for the functions that are common in malicious code (used to obfuscate its content and execute it). These commands are read-only diagnostics: they identify candidates for manual review and delete nothing. Remember that the presence of these functions does not necessarily mean an infection (some legitimate plugins use them), so review each result yourself before taking any action:
# Search for commonly abused functions (candidates for review only)
grep -rEn "base64_decode|eval\(|gzinflate|str_rot13|assert\(|create_function" /path/to/site/
# PHP files inside the uploads folder — they should not be there at all
find /path/to/site/wp-content/uploads/ -type f -name "*.php"
# Files modified in the last 7 days (compare with when you last touched the site)
find /path/to/site/ -type f -name "*.php" -mtime -7
# Very recent files that may have been planted during the hack
find /path/to/site/ -type f -mtime -2 -lsComparing files with a clean copy
The most powerful way to detect injections in core and plugin files is to compare them (diff) with an original clean copy of exactly the same version, downloaded from the official source. Any difference in files that are supposed to be unchanging is a warning sign:
# Download the official core for the same version into a separate folder, then compare
diff -rq /path/to/clean-core/ /path/to/site/ | grep -E "differ|Only in /path/to/site"
# Inspect a specific suspicious file before any decision
diff /path/to/clean-core/wp-settings.php /path/to/site/wp-settings.phpScanning the database and scheduled tasks
The database is an often-overlooked hiding place. Search the wp_options table (especially values such as siteurl and home, which can be injected) and wp_posts for scripts, iframe elements or hidden external links. And review scheduled tasks carefully: a malicious cron job can re-plant everything an hour after your cleanup. Check both the server's cron and WordPress's internal scheduler (WP-Cron):
# Server cron jobs for the current user (review any unfamiliar line)
crontab -l
# System scheduled tasks (review them read-only)
ls -la /etc/cron.* 2>/dev/null
# Via WP-CLI: list the scheduled tasks in WordPress
wp cron event listHow do you clean the site: manual cleanup or a clean restore?
You have two paths, and each has its place. But the general rule for most site owners is clear: restoring from a trusted clean backup taken before the hack is the safest and fastest option. Manual cleanup is precise but carries the risk of leaving a single backdoor behind that undoes all the effort. The following table weighs the two:
| Criterion | Restoring from a clean backup | Manual cleanup |
|---|---|---|
| Safety from infection remnants | High (it replaces everything) | Depends on your accuracy (risk of a remaining backdoor) |
| Speed | Fast if a sound backup is available | Slow and requires experience |
| Loss of recent content | Possible (anything after the backup date) | Usually no loss |
| Experience required | Low | High |
| Best for | Most sites that have sound backups | No clean backup, or a limited, known infection |
The recommended path: restoring from a clean backup
Choose a backup that you are confident predates the first infection (this is where the documentation from step 1 proves its value). Remember that a silent hack can go unnoticed for weeks, so don't settle for the latest backup; go back to the earliest point you trust to be clean. Restore the files and the database together. And before putting the site back online, update everything (core, plugins and themes), close the hole and reset the credentials; otherwise you are restoring the very open door the attacker came in through. As for content published after the backup date, re-enter it manually after checking it, not through a partial restore that may bring the infection back.
The manual path: when, and why to be careful
You resort to manual cleanup if you have no trusted clean backup, or if the infection is limited and its location is fully known. Its foundation is replacement, not patching: replace the core, plugin and theme files with complete original copies from the official sources instead of trying to "fix" the injected files line by line. As for files with no official replacement (such as wp-config.php and the database), clean them very carefully after understanding every change. The governing rule: don't declare success until you are sure every backdoor and malicious scheduled task has been removed, since they are the main cause of reinfection. At the slightest doubt, go back to the clean-restore path.
How do you close the entry hole?
This step is the difference between a lasting fix and an inevitable return. Cleanup removes the symptoms; closing the hole removes the cause. If you clean without knowing how the attacker got in, you are just waiting for them to come back. Identify the entry vector and close it before putting the site back online. The following table lists the most common vectors and how to close them:
| Entry vector | How it is exploited | How to close it |
|---|---|---|
| An outdated plugin/theme with a vulnerability | Exploiting a published vulnerability before the update | Update immediately or remove the affected component for good |
| A pirated (nulled) plugin/theme | Comes injected with malware from the moment it is installed | Delete it and replace it with an official copy |
| A weak/leaked password | Automated guessing or credential stuffing | Strong, unique passwords + 2FA + limited login attempts |
| Lax file permissions (777) | Any process can write and inject code | Set 644 for files and 755 for folders |
| An unsanitized file upload | Uploading a web shell through an exposed form | Block PHP execution in the uploads folder + update |
| An outdated PHP/server version | Exploiting a server-level vulnerability | Update the PHP version and the software |
| Contaminated shared hosting | Infection from another account on the same server | Isolate the account + coordinate with the host |
An exposed wp-config or other sensitive file | Reading the database credentials and keys | Restrict access + tighten permissions |
Diagnosing the vector starts with the evidence you collected: the date of the first infected file, the access logs around that time, and the component where the infection was concentrated. If all the injected files belong to a particular plugin, it is the prime suspect. If the injection was preceded by a flood of login attempts in the logs, the vector is most likely a password. Don't guess and move on; the point you don't close is the one they come back through. And if you use cPanel, see the guide to securing cPanel, since the vector may be at the account level, not in WordPress alone.
How do you reset all credentials and keys?
Assume that all credentials are exposed, because they most likely are. An attacker who reached your files has seen wp-config.php and everything in it: the database name, its password and the encryption keys. Changing the WordPress password alone is not nearly enough. Reset everything, in this order, to avoid breaking the connection between the site and its database:
- WordPress keys and salts: generate new values from the official generator and put them in
wp-config.php. This invalidates all active sessions immediately, so the attacker is kicked out even if they are logged in. - The passwords of all users: especially administrators. Force a full reset, and don't stop at your own account.
- The database password: change it from the hosting panel, then update the value in
wp-config.phpto match. - Hosting/cPanel credentials: the main account password and the control panel.
- FTP/SFTP and SSH accounts: change their passwords or delete any you don't recognize, and regenerate SSH keys.
- API keys and any external secrets: payment gateways, email services, cloud storage; any of them may have leaked.
And most importantly after the reset: review the user list and delete any admin account you did not create. Backdoors are not only files; a planted admin account is a backdoor with full privileges, and it may be hidden from the usual list view, so check at the database level if necessary.
How do you get delisted by Google and blacklists?
If Google has flagged your site as a "deceptive site" or a warning appears in the browser, traffic collapses even after cleanup, because the listing is not lifted automatically. You need to request a review, but only after you are completely sure the site is clean, because a review request for a site that is still infected is rejected and delays the process. Follow these steps:
- Confirm the site is completely clean: rescan it with more than one tool, and make sure the files, the database and scheduled tasks are free of any remnants.
- Request a review in Google Search Console: in the "Security issues" section, explain what you found and how you cleaned it, then request a review.
- Do the same in Bing Webmaster Tools if your site is listed there too.
- Request removal from other blocklists: some services list infected domains independently of Google; check with reputation lookup tools and submit a removal request to each one.
- Deal with email spam: if your server was sending spam, your domain may be listed on email blacklists. After stopping the source, request removal and enable SPF, DKIM and DMARC records to restore your sending reputation.
The review can take anywhere from hours to days. Don't submit repeated requests in a hurry, as that can delay it. Make sure the cleanup is airtight the first time.
How do you harden the site to prevent another hack?
Cleanup takes you back to square one; hardening keeps you from ending up there again. A site that has been hacked once is a tempting target for repeat attempts, because attackers keep lists of sites they have already compromised. Build stacked layers of defense, each of which buys time and raises the cost of a hack.
The essential layers of protection
The following table summarizes the pillars of hardening after cleanup:
| Layer | What it does | Priority |
|---|---|---|
| Regular updates | Closes vulnerabilities before they are exploited | Critical |
| Two-factor authentication (2FA) | Makes a stolen password worthless | Critical |
| WAF firewall | Blocks the attack before it reaches the site | High |
| Strong, unique passwords | Defeats guessing and reuse | High |
| Correct file permissions (644/755) | Prevents code injection | High |
| Principle of least privilege | Limits the damage from any compromised account | Medium |
| Blocking PHP execution in the uploads folder | Disables an uploaded web shell | Medium |
| File integrity monitoring | Detects injections early | Medium |
| Tested off-site backups | The last safety net | Critical |
Updates alone close off the source of most hacks, because most infections exploit known vulnerabilities in outdated plugins and themes. Enable automatic updates for security fixes, and delete (don't just deactivate) every component you don't use. Two-factor authentication, meanwhile, is the strongest single layer because it defeats the most common entry vector: signing in with a stolen or guessed password. For the full details of hardening WordPress, see the guide to securing a WordPress site, and for the encryption that protects credentials in transit, see installing an SSL certificate and enabling HTTPS.
Backups as a recovery plan
The most important lesson from this whole experience: a clean backup would have turned the disaster into a passing incident. Adopt the 3-2-1 rule (three copies, on two media, one off-site), and automate backups so they are uploaded automatically to external storage separate from the server. Most importantly, keep a chain of backups going back several weeks, because a silent hack sometimes means the latest backup is infected and you need an older clean restore point. And test restores regularly: a backup that has never been test-restored = no backup.
For network-level protection before traffic reaches your server, a cloud CDN/WAF layer adds an important defense against automated attacks and distributed denial-of-service attacks. See DDoS protection to understand this layer and how it complements WordPress hardening.
The post-cleanup checklist
Before you declare the site clean and secure, review every item:
| Item | Required state |
|---|---|
| Confirm removal of all injected files and backdoors | ✓ Confirmed with more than one tool |
| Check the database for hidden injections | ✓ Clean |
| Review scheduled tasks (cron + WP-Cron) | ✓ No malicious tasks |
.htaccess reviewed and clean | ✓ No malicious redirects |
| Delete any planted admin accounts | ✓ Done |
| Close the entry hole (update/delete/fix) | ✓ Closed |
| Reset all passwords | ✓ Thorough (WP/DB/hosting/FTP) |
| Generate new salts and keys | ✓ Updated |
| Full updates (core/plugins/themes) | ✓ Latest version |
| Google review request/blacklist removal | ✓ Submitted after cleanup |
| Enable 2FA + WAF + off-site backups | ✓ Enabled |
| Test a backup restore | ✓ Successful |
Common problems and fixes after cleanup
Even after careful work, leftover problems may appear. The following table links the symptoms to their causes and fixes:
| Problem | Likely cause | Fix |
|---|---|---|
| The hack returns within days | A backdoor or cron job that was not removed | Deep scan + clean restore + remove every malicious cron job |
| The "deceptive site" warning remains | Delisting was not requested, or infection remnants remain | Confirm the site is clean, then request a review |
| Spam pages still appear in search results | A database injection that was not cleaned | Clean the tables + request reindexing |
| The site's email goes to spam for everyone | Listed on email blocklists | Stop the source + request removal + SPF/DKIM |
| Persistent slowness/high load | A leftover mining script or a malicious cron job | Review processes and scheduled tasks |
| Unable to log in to the dashboard after cleanup | New salts invalidated the session (normal) | Log in again with the new credentials |
| A "mixed content" warning after the restore | Leftover http:// links | Fix the links and force HTTPS |
When should you call in a professional?
Not every hack is one you should handle yourself, and there is no shame in asking for help. Use a specialized cleanup service or a security expert if any of the following applies: the site is commercially sensitive (a store that processes payments or holds customer data), the infection is complex and keeps coming back despite your efforts, you lack the technical experience to work safely with SSH and the database, or the time window is tight and leaves no room for trial and error. Many hosting companies offer managed scanning and cleanup (sometimes through server-level tools such as Imunify360), which is a fast, reliable option if you are not sure. A professional's fee is usually far lower than the cost of a commercial site staying infected or getting hacked again and again.
Expert tips for a cleaner response
Once you have mastered the basics, raise your readiness with these practices:
- Document everything during the response: the symptoms, the dates, the infected files and the steps taken. This speeds up any later investigation and helps if the incident recurs.
- Always work on a copy: carry out the cleanup and any experiments in an isolated staging environment before touching the live site, whenever possible.
- Assume there is a backdoor until proven otherwise: it is the main reason a hack returns. Don't declare success until you are sure it has been removed.
- Monitor file integrity going forward: a tool that alerts you as soon as any core file is modified catches the next infection in its first hours.
- Monitor for at least two weeks after cleanup: scan daily and review the logs. Many leftover infections show up within this window.
- Restrict PHP execution where it is not needed: blocking PHP execution in the uploads folder disables any uploaded web shell even if it gets there.
Conclusion
A hacked site is not the end of the world, but handling it the wrong way can drag it out indefinitely. The golden rule is the order: confirm > isolate and take an evidence backup > scan every location > clean or restore from a clean backup > close the entry hole > reset all credentials and keys > get delisted by Google > harden to prevent a repeat. The fatal mistake is jumping to a restore before closing the hole, or declaring success before confirming that every backdoor and malicious scheduled task has been removed. Above all, remember that the best response to a hack is for it never to happen: regular updates, two-factor authentication, a firewall, correct permissions and tested off-site backups; these layers are the difference between a site that holds up and a site that gets hacked again and again. Apply the checklist, keep monitoring after cleanup, and make security part of your site's routine, not a reaction after it is too late.
Frequently asked questions
How can I tell quickly that my site has been hacked? The main signs: a browser or Google warning about a "deceptive/dangerous site," strange redirects for visitors (especially those coming from search results), spam pages or posts appearing, unexplained slowness or high CPU load, a message from your hosting provider, admin accounts you did not create, or your site's email landing in spam. Confirm the suspicion with a neutral external scanning tool and with the Google Search Console report before you start any cleanup.
Should I delete the site and start over right away? Don't rush. Before deleting anything, isolate the site and take a full backup as evidence, because it reveals how the attacker got in and helps prevent a repeat. Then restore from a clean backup taken before the hack instead of rebuilding from scratch, whenever one is available. Most importantly, don't restore before closing the entry hole, or the hack will happen again immediately.
Which is safer: manual cleanup or restoring from a backup? For most site owners, restoring from a trusted clean backup taken before the hack is the safest and fastest option, because it replaces everything and reduces the risk of a backdoor remaining. Manual cleanup is more precise but carries the risk of leaving a single malicious file behind that undoes all the effort; it is suitable when you have no clean backup or when the infection is limited and its location is fully known.
Why does the hack come back after I cleaned the site? The most common cause is a backdoor that was not removed, a scheduled task (cron) that re-plants the infection, or the original entry hole being left open so the attacker came back through it. The fix is a deep scan covering the files, the database and all scheduled tasks, a complete clean restore, and actually closing the hole before putting the site back online.
Is changing the WordPress password enough?
Not at all. An attacker who reached your files has seen wp-config.php with all its secrets. Reset everything: the passwords of all users, the database, the hosting/cPanel, FTP/SSH, API keys, and generate new salts in wp-config.php to invalidate all active sessions immediately and kick the attacker out even if they are logged in.
How do I get Google's "deceptive site" warning removed? Once you are completely sure the site is clean (files, database and scheduled tasks), go to the "Security issues" section in Google Search Console and request a review, explaining what you found and how you cleaned it. Don't request a review for a site that is still infected, or it will be rejected and delayed. The review can take anywhere from hours to days.
Where does malicious code usually hide?
Usually in several places at once: modified core files, PHP files planted in the uploads folder, functions.php and the theme header, the .htaccess file (redirects), and inside the database (the options and posts tables), plus scheduled tasks that re-plant the infection. That is why a thorough scan of all these places is essential; cleaning one place and leaving another means an immediate return.
Do scanning tools detect every infection? No tool is perfect. An external scan (such as Sucuri SiteCheck) detects visible injections and blocklist listings but cannot see the files. An internal scan (such as Wordfence) compares against the original core files and detects modifications and backdoors. It is best to combine more than one tool with a manual review and a comparison of the files against a clean copy, because what one tool misses another may catch.
Can an infection spread between sites on shared hosting? Yes, and it is a real risk. On shared hosting, a hack can spread between accounts on the same server if permissions or isolation are weak. If you suspect this, coordinate with your hosting provider to isolate your account and scan the other sites, and move critical sites to an isolated environment (such as a VPS) to prevent cross-contamination.
How long does it take to clean a hacked site? It varies a lot: a simple infection with a clean backup ready can be resolved in an hour or two (restore + close the hole + reset credentials). A complex infection spread across the files, the database and scheduled tasks, or the lack of a clean backup, can take hours to days. Don't rush at the expense of accuracy; an incomplete cleanup means the hack returns and the process starts all over again.
When should I call in a security expert instead of handling it myself? If the site is commercial and processes payments or stores customer data, if the infection keeps coming back despite your efforts, or if you lack the experience to work safely with SSH and the database. Many hosting companies offer a fast, reliable managed cleanup service. A professional's fee is usually far lower than the cost of a site that stays infected or keeps getting hacked again.
Sources
- OWASP Top 10 — The ten most critical web application security risks
- WordPress — Hardening your installation
Frequently asked questions
How can I tell quickly that my site has been hacked?
The main signs: a browser or Google warning about a "deceptive/dangerous site," strange redirects for visitors (especially those coming from search results), spam pages or posts appearing, unexplained slowness or high CPU load, a message from your hosting provider, admin accounts you did not create, or your site's email landing in spam. Confirm the suspicion with a neutral external scanning tool and with the Google Search Console report before you start any cleanup.
Should I delete the site and start over right away?
Don't rush. Before deleting anything, isolate the site and take a full backup as evidence, because it reveals how the attacker got in and helps prevent a repeat. Then restore from a clean backup taken before the hack instead of rebuilding from scratch, whenever one is available. Most importantly, don't restore before closing the entry hole, or the hack will happen again immediately.
Which is safer: manual cleanup or restoring from a backup?
For most site owners, restoring from a trusted clean backup taken before the hack is the safest and fastest option, because it replaces everything and reduces the risk of a backdoor remaining. Manual cleanup is more precise but carries the risk of leaving a single malicious file behind that undoes all the effort; it is suitable when you have no clean backup or when the infection is limited and its location is fully known.
Why does the hack come back after I cleaned the site?
The most common cause is a backdoor that was not removed, a scheduled task (cron) that re-plants the infection, or the original entry hole being left open so the attacker came back through it. The fix is a deep scan covering the files, the database and all scheduled tasks, a complete clean restore, and actually closing the hole before putting the site back online.
Is changing the WordPress password enough?
Not at all. An attacker who reached your files has seen wp-config.php with all its secrets. Reset everything: the passwords of all users, the database, the hosting/cPanel, FTP/SSH, API keys, and generate new salts in wp-config.php to invalidate all active sessions immediately and kick the attacker out even if they are logged in.
How do I get Google's "deceptive site" warning removed?
Once you are completely sure the site is clean (files, database and scheduled tasks), go to the "Security issues" section in Google Search Console and request a review, explaining what you found and how you cleaned it. Don't request a review for a site that is still infected, or it will be rejected and delayed. The review can take anywhere from hours to days.
Where does malicious code usually hide?
Usually in several places at once: modified core files, PHP files planted in the uploads folder, functions.php and the theme header, the .htaccess file (redirects), and inside the database (the options and posts tables), plus scheduled tasks that re-plant the infection. That is why a thorough scan of all these places is essential; cleaning one place and leaving another means an immediate return.
Do scanning tools detect every infection?
No tool is perfect. An external scan (such as Sucuri SiteCheck) detects visible injections and blocklist listings but cannot see the files. An internal scan (such as Wordfence) compares against the original core files and detects modifications and backdoors. It is best to combine more than one tool with a manual review and a comparison of the files against a clean copy, because what one tool misses another may catch.
Can an infection spread between sites on shared hosting?
Yes, and it is a real risk. On shared hosting, a hack can spread between accounts on the same server if permissions or isolation are weak. If you suspect this, coordinate with your hosting provider to isolate your account and scan the other sites, and move critical sites to an isolated environment (such as a VPS) to prevent cross-contamination.
How long does it take to clean a hacked site?
It varies a lot: a simple infection with a clean backup ready can be resolved in an hour or two (restore + close the hole + reset credentials). A complex infection spread across the files, the database and scheduled tasks, or the lack of a clean backup, can take hours to days. Don't rush at the expense of accuracy; an incomplete cleanup means the hack returns and the process starts all over again.
When should I call in a security expert instead of handling it myself?
If the site is commercial and processes payments or stores customer data, if the infection keeps coming back despite your efforts, or if you lack the experience to work safely with SSH and the database. Many hosting companies offer a fast, reliable managed cleanup service. A professional's fee is usually far lower than the cost of a site that stays infected or keeps getting hacked again.