Close Menu
SmartMag DigiTech

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    What's Hot

    Best Landing Page Builders for Fast Marketing Campaigns

    Nov 23, 2026

    Best Async Communication Tools for Distributed Teams

    Nov 21, 2026

    How to Use Search Console to Uncover Content Gaps

    Nov 20, 2026
    StackBench
    Demo
    • Home
    • Hosting & Domains
      • Hosting
      • Domains
      • Cloud & Servers
    • Web Tools
      • Web Tools
      • Website Builders
      • SEO Tools
      • Security Tools
      • Analytics
    • Marketing
      • Email Marketing
      • Marketing Stack
    • Software
      • Productivity
      • Business Software
      • Collaboration
      • CRM
    • Ecommerce
      • Ecommerce Tools
      • Freelancer Tools
      • Small Business
    • Guides
      • Comparisons
      • Buying Guides
      • How-To Guides
    SmartMag DigiTech
    Home/Security Tools/How to Recover a Hacked WordPress Site, Step by Step
    Hosting

    How to Recover a Hacked WordPress Site, Step by Step

    By Maya EllisonJan 8, 20265 Mins Read211 Views
    How to Recover a Hacked WordPress Site, Step by Step

    A hacked WordPress site announces itself in small, wrong details. A login page that loads a half-second slower than it should. A hosting dashboard showing a spike in outbound traffic at 3 a.m. A client emailing to ask why the site is redirecting to a Canadian pharmacy. The discovery usually arrives through a third party, which is the first insult: the owner finds out last.

    Recovery is a specific, sequential job, and it rewards the person who slows down instead of the person who clicks fastest. The instinct is to start deleting suspicious files, changing the password, and hoping. That instinct is wrong in a way that costs days. A hacked site is a crime scene with a live intruder, and the order of operations matters more than the speed.

    Confirm the breach before touching anything

    Not every weird behavior is a hack. A broken plugin update can produce white screens, redirect loops, and database errors that mimic compromise. Before pulling the site apart, run the checks that separate a bug from an intrusion.

    Google Search Console will flag "This site may be hacked" or "Harmful content" under Security Issues if Google has already crawled the payload. A malware scanner such as Wordfence, Sucuri, or the host's built-in tool will name specific files. The hosting account's access logs, if the host exposes them, will show POST requests to odd endpoints at odd hours, or logins from countries the owner has never visited.

    One reliable tell: check the date stamps on core WordPress files. If wp-config.php or files inside /wp-includes/ have modification dates that do not match the last update, something wrote to them after the fact. Core files should only change during updates. Any other timestamp is a fingerprint.

    Take the site offline and preserve a copy

    The moment compromise is confirmed, the site should come down. A maintenance mode page, a 503 response, or a full takedown through the host all work. Leaving a hacked site live gives the attacker time to deepen access, and it keeps feeding malware to visitors, which compounds the reputational damage.

    Before deleting a single file, pull a full backup: files, database, and logs. The database dump especially, because a hacked site often hides payloads in wp_options, in widget text, or inside post content where a file scanner will never look. The preserved copy serves two purposes. It is evidence if the host or a security firm needs to trace the entry point, and it is a reference for what the site looked like before the cleanup so nothing legitimate gets thrown out with the malware.

    Store that backup somewhere off the server. A copy sitting in the same hosting account is a copy the attacker can also read or delete.

    Rotate every credential the site touches

    Passwords get changed, but the credentials that actually matter are the ones nobody thinks about. The full rotation list: WordPress admin accounts, the database user and password in wp-config.php, the hosting control panel, FTP and SFTP accounts, SSH keys, and any API keys stored in plugins (payment gateways, email services, analytics). Attackers routinely plant a new admin user and leave it dormant, so the user list needs an audit, not just a password reset. Any account that was not created by the owner should be deleted on sight.

    The salts in wp-config.php need regenerating too. WordPress uses these to sign login cookies, and stale salts mean an attacker who captured a valid session cookie can walk back in even after the password changes. The WordPress.org salt generator produces a fresh block in seconds; paste it in, save, and every existing session is invalidated.

    Rebuild from clean core rather than scrubbing infected files

    Here is where most recoveries go wrong. Owners run a scanner, delete the flagged files, and call it done. The problem is that scanners match known signatures, and a competent attacker leaves backdoors that no signature recognizes: a single obfuscated line inside an otherwise normal plugin file, a mu-plugin that loads from a database option, a cron job that re-downloads the payload after deletion.

    The safer path is replacement. Download a fresh copy of WordPress from wordpress.org, delete the wp-admin and wp-includes folders on the server, and upload the clean versions. Keep wp-content and wp-config.php. Then reinstall every plugin and theme from the official repository or the vendor's original zip, never from the copy on the server. Custom themes and plugins are the exception; those need a line-by-line review, which is tedious and unavoidable.

    The uploads folder deserves its own pass. Attackers love /wp-content/uploads/ because it is writable and often excluded from scans. Any .php file sitting in uploads is suspicious by definition; WordPress does not put PHP there. A quick listing of that folder sorted by file type will usually surface the payload.

    Clean the database, where file scanners do not look

    A fresh core and reinstalled plugins do nothing about a payload stored in the database. The common hiding spots are the wp_options table (rogue entries with names like _transient_ followed by random characters), widget text, and the content of posts and pages where an iframe or script tag was injected.

    Searching the database for the strings <script, <iframe, and eval( is a blunt but effective first sweep. A tool like phpMyAdmin or Adminer makes this manageable. The wp_users and wp_usermeta tables need a look as well, since a hidden admin account sometimes lives there with a session token rather than a visible login. Plugins such as Wordfence and Sucuri include database scanners that automate much of this, and their output is worth reading line by line rather than clicking "fix all."

    Close the entry point or the cleanup is temporary

    Every compromise has an entry point, and if it stays open, the site gets reinfected within days. The usual suspects: an outdated plugin with a known vulnerability, a nulled premium theme downloaded from a warez site, a weak admin password, or a stolen FTP credential reused from another breach.

    The hosting access logs are the best source for finding the entry. Look for POST requests to admin-ajax.php, xmlrpc.php, or a plugin's endpoint in the hours before the first suspicious file appeared. That pattern usually names the vulnerable component. If the logs are gone or unreadable, the safe assumption is that the entry point was an outdated plugin, and every plugin should be updated or removed as part of the rebuild.

    Two hardening steps close the most common doors: disabling file editing in wp-config.php with define('DISALLOW_FILE_EDIT', true); and turning off XML-RPC if the site does not use it. Neither is a silver bullet, but both remove attack surface that gets exploited constantly.

    Request a review from Google and the host

    Once the site is clean, Google needs to be told. Search Console has a "Request Review" button under Security Issues, and the review usually clears within a few days if the site is genuinely fixed. Skipping this step leaves the red warning in search results long after the malware is gone, and that warning costs traffic and trust in a way that outlasts the hack itself.

    The host should be notified too, partly as a courtesy and partly because shared hosting environments sometimes get flagged at the network level. Some hosts will run their own scan and confirm the cleanup. Others will not, but the notification puts the account on record as responsive rather than abandoned.

    What the recovery calendar actually looks like

    A real cleanup of a moderately infected site takes most of a working day, sometimes two if the database is messy or a custom theme needs review. The first hour goes to confirmation and backup. The next three to credential rotation and core replacement. The database scrub is the slow part, often an evening of searching and reading. The Google review request takes five minutes and then sits in a queue.

    The reinfection window is the part nobody plans for. A site cleaned on a Friday and left unwatched over the weekend can be compromised again by Monday if the entry point was missed. Monitoring for the first two weeks after recovery, watching for new admin users, unexpected file changes, and odd outbound traffic, is the difference between a fix and a recurring problem. A managed security service costs money, and for a site that has already been hacked once, that cost buys something specific: the next intrusion gets caught in hours instead of weeks.

    The site that comes back from a hack is rarely identical to the one that went down. Some plugins get dropped for good. The theme gets rebuilt leaner. The backup schedule finally gets automated. Owners who treat recovery as a checklist tend to get hacked again. Owners who treat it as an audit of everything the site was doing wrong end up with a smaller, faster, more defensible site than the one the attacker found.

    Related Posts

    Seven Web Analytics Mistakes Beginners Keep Making

    Nov 19, 2026

    Five Async Standup Mistakes That Quietly Kill Momentum

    Nov 18, 2026

    How to Choose a Web Host for Your First Site

    Nov 16, 2026

    Best Keyword Research Tools for Small Business Owners

    Nov 15, 2026

    The Project Management Software Checklist for Small Businesses

    Nov 14, 2026

    How to Choose a Payment Processor for Your Store

    Nov 13, 2026
    Top Posts

    Web Application Firewalls for Beginners: What You Need to Know

    Nov 12, 20267,713 Views

    Cheap Registration vs Premium Domains: What You Actually Get

    Nov 10, 20265,309 Views

    Pipeline Setup Mistakes That Quietly Cost You Deals

    Nov 9, 2026435 Views
    Don't Miss

    How to Build a Welcome Email Sequence That Converts

    Nov 8, 2026

    Most welcome sequences fail in the first ninety seconds, before a single subscriber reads past the subject line. The email arrives instantly.

    Domains vs Hosting: What's the Actual Difference?

    Nov 7, 2026

    Productivity Tools for Beginners Running a Side Business

    Nov 2, 2026

    Best DNS Security Services for Developers and Hosting Resellers

    Oct 31, 2026
    Latest Reviews
    8.9

    Best Website Builders for Small Agencies Juggling Clients

    Oct 30, 2026

    Choosing a Domain Registrar: A Beginner's Checklist

    Oct 28, 2026
    72

    Website Builder vs Custom Code: A Fair Fight

    Oct 27, 2026
    Most Popular

    Renewal Price Traps: Reading the Fine Print on Hosting

    Oct 25, 20267,713 Views

    How to Budget for SaaS Productivity Tools Per Employee

    Oct 21, 20265,309 Views

    How to Launch an Online Store in a Weekend

    Oct 18, 2026435 Views
    Our Picks

    CRM for Freelancers vs Small Agencies: Which Fits Your Workflow?

    Oct 14, 2026

    Cookie Consent Mistakes That Quietly Break Your Analytics

    Oct 11, 2026

    Stripe vs PayPal: Taking Client Payments as a Freelancer

    Oct 10, 2026

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    SmartMag DigiTech
    • Home
    • About Us
    • Contact Us
    • Privacy Policy
    • Affiliate Disclosure
    © 2026 ThemeSphere. Designed by ThemeSphere.

    Type above and press Enter to search. Press Esc to cancel.