WordPress help

WordPress hacked: what now?

Strange redirects, spam in Google or a message from your host: that is a shock. Stay calm and work in a fixed order. This is how I go about it.

  • One dedicated contact
  • Reply within a few hours
  • 15+ years of experience

How to recognise a hack

A hack is often deliberately invisible to the admin. Seeing nothing yourself while logged in therefore says little. Watch for these signs:

  • Visitors are sent to another site, sometimes only on mobile or only when coming from Google
  • Google shows pages on your domain with spam, for example in another language or about medicines
  • There are administrators in WordPress you do not know
  • Your host or Google Search Console reports malware, or your browser warns about your own site
  • Your site suddenly sends a lot of mail, or your host has blocked it
  • There are PHP files in your uploads folder

Step 1: do not start deleting straight away

The temptation is strong to throw files away or wipe the site right away. Do not. You first want to know how the attacker got in, otherwise it simply happens again. Make a full copy of the current, hacked state, files and database, and keep it separately.

Could visitors come to harm, for example because they are sent to a malicious site? Then put the site in maintenance mode for now or ask your host to take it offline.

Step 2: passwords and access

Change all passwords: of the WordPress admins, your hosting account, FTP or SFTP, the database and the admins’ email address. Remove users you do not know. Replace the security keys (salts) in wp-config.php, so everyone is logged out everywhere. Then turn on two-factor authentication for all admins.

Step 3: clean the site thoroughly

A malware scanner finds a lot, but not everything. Cleaning thoroughly means reinstalling WordPress itself, your theme and your plugins from the official source, instead of trusting the existing files. That leaves only your own files: the uploads folder, wp-config.php and perhaps a custom theme. I check those by hand for code that does not belong, such as PHP files among the images or suspicious lines at the top of wp-config.php.

Do not forget the database. Attackers also hide scripts in posts, widgets or settings, and sometimes create admins you do not see in the normal overview. Search for unknown scripts and check the users directly in the database.

Step 4: close the hole

An attacker usually gets in through an outdated or abandoned plugin or theme, a weak or leaked password, or another site on the same hosting account. Check your server’s log files for when the first suspicious files appeared and what happened around that time. Update everything, remove what you do not use and replace plugins that are no longer maintained.

Step 5: Google and your visitors

If Google has marked your site as unsafe, request a review in Search Console once everything is clean. Spam pages in the search results disappear once they no longer exist, but that can take a while. If customer data was taken, for example from a shop, find out what your obligations are.

Prevention is easier than cleaning up

What prevents a hack best:

  • Keeping up with updates, tested first
  • Daily backups somewhere other than your server
  • Strong, unique passwords and two-factor authentication for admins
  • A limit on login attempts and a firewall
  • No plugins or themes from unofficial sources
  • Malware scans and monitoring, so you notice before your visitors do

Updating WordPress safely →

Need help with a hacked site?

I clean up hacked WordPress sites and find out how the attacker got in. You get a fixed price upfront. After that I can look after the site with WordPress maintenance for €5 a month, or WooCommerce maintenance for €10 a month, paid six months upfront.

Request a fixed price →

See WordPress maintenance →

See WooCommerce maintenance →

FAQ

Good to know

Is your question not here? Feel free to send me a message.

Can I not just restore an old backup?

That can be a quick first step, if you are sure the backup is from before the hack. But the hole still needs closing, otherwise you are hacked again through the same plugin or password.

Is a security plugin enough?

A security plugin helps, but it does not replace updates, backups and strong passwords. And once a site is hacked, the attacker can switch such a plugin off or get around it.

How long does cleaning take?

That depends on the size of the site and how deep the hack goes. After a first look I tell you what I see and what it costs.

Contact

Say hello

A question, an idea or a job? I reply usually within a few hours, between 08:00 and 20:00.

Email