WordPress homepage replaced by a defacement test message

WordPress Homepage Defaced? How to Restore It and Find the Cause

Tested in the ShoHost fix lab on 12 October 2026: WordPress 7.1.3, PHP 8.4, Apache with MariaDB 11.8. Every screenshot below is from that lab, not from a customer site.

Safety note: Every “attack” in this guide was a harmless marker (text strings and example.com links) planted on a throwaway local WordPress install. Nothing here is real malware. Don’t experiment on your live site.

A defacement replaces your homepage with the attacker’s message. Often the inner pages still work. One of the simplest tricks is to drop an index.html file into your site’s root folder, because the web server serves it before WordPress’s index.php.

WordPress homepage replaced by a defacement test message
The lab marker took over the homepage.

Detect

In cPanel File Manager, sort public_html by Last Modified. A new index.html or index.htm, or changed theme files (header.php, index.php), are the usual suspects. Also check .htaccess for a DirectoryIndex change.

Newest files listing showing an injected index.html in the WordPress root
The newest file in the root folder was the culprit.

Important: in our lab, wp core verify-checksums reported success even with the extra index.html in the root folder, so don’t rely on it alone. Sort by date and look for yourself.

Restore

  1. Before you change anything, take a full backup in cPanel (Files → Backup, or your host’s backup tool): home directory plus database. Keep it as evidence. Don’t restore it as if it were clean.
  2. Delete the injected file. If theme files were changed, reinstall the theme (wp theme install name --force) or restore it from a backup you know is clean.
  3. Find out how they got in (an outdated plugin, a weak FTP password) and fix that before you call the job done: follow the full hacked site checklist.
Removing the defacement file and verifying the site returns HTTP 200
File removed.
WordPress homepage restored after removing defacement
Homepage restored.

To prevent it, use SFTP instead of FTP, delete unused FTP accounts, and set up an uptime or content monitor that alerts you when your homepage text changes.

Need a hand?

Not sure your cleanup is complete? If you host with ShoHost, contact support on WhatsApp (+91 94880 91432) or at [email protected] before you change anything else. Moving a site you’ve just cleaned? ShoHost WordPress hosting includes free SSL and free migration.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *