In this guide
What a defacement is
A defacement replaces your visible content, usually the homepage, with the attacker’s message. Common versions:
- the theme’s
index.php, or WordPress’s ownindex.php, replaced with a “Hacked by…” page; - a new
index.htmlin the site root, which many servers show before WordPress; - every post title or the site title changed through the database;
- the attacker’s page set as the static front page.
Step 1: Take a copy before you fix anything
Back up the site as it is. The defaced files and their timestamps help find how the attacker got in.
Step 2: Restore the content
- Remove the attacker’s
index.htmlor restoreindex.phpfrom a clean copy. - If the theme was changed, reinstall it from the original source.
- If posts or the site title were changed, restore them, either from a backup of the database taken before the attack, or by hand.
Step 3: Assume there’s more than you can see
A defacement is the visible part. Attackers very often also leave backdoors, extra admin users, or quietly add spam or redirects elsewhere. Check users, look for PHP files in uploads, verify core files with wp core verify-checksums, and scan the site. My step-by-step guide to fixing a hacked WordPress site covers everything.
Step 4: Close the way in
Defacements usually come through an outdated plugin with a known vulnerability, or a weak password. Update everything, delete what you don’t use, change all passwords, end all sessions, and turn on two-factor login. See how to secure WordPress after a hack.
Step 5: Check search results
Search site:yourdomain.com to see if Google indexed the defaced page. Once the site is fixed, use URL Inspection → Request indexing on your homepage so Google picks up the real content quickly.
From my cleanup work: a typical defacement case is fixed in an hour: the homepage is restored, and that’s when the real work starts. In most of them I find at least one backdoor and an extra admin account that the defacer, or someone else using the same hole, left behind. Restoring the homepage without that check is how sites get defaced twice in the same month.
Want it handled for you? A defacement is a hacked site, and my hacked website cleanup covers restoring it, removing the backdoors and closing the hole, for $95.