Your WordPress site redirects to a strange page, Google warns that it may be hacked, or an administrator you do not know appeared. Stay calm: most infections can be cleaned if you go step by step and do not delete things in a hurry. This is a general checklist, it does not depend on one tool.

Signs that a WordPress site is hacked

  • Visitors are sent to another site, or see pop-ups and adverts you never added.
  • Google shows “This site may be hacked” or a red warning page in the browser.
  • Search results show pages you did not write, often with foreign words or spam products.
  • An administrator account you do not know, or settings you did not change.
  • Your host suspended the site, or sent a message about malicious files.
  • The site became slow without a reason, or e-mails you send land in spam.

The first 15 minutes

  1. Do not delete everything. You need the infected files to find out how it happened.
  2. Make a full copy of the files and the database, even if they are infected, and keep it away from the site. If you have a clean backup from before the problem, find it and note its date.
  3. Put the site out of sight, for example with a coming soon page, so visitors and search engines do not meet the infection while you work.
  4. Change every password: all WordPress administrators, the hosting panel, FTP or SFTP and the database. Do it from a computer you trust.
  5. Remove administrator accounts you do not know and change the security keys (salts) in wp-config.php, which signs everyone out.

Find what was changed

Malware hides in files and in the database, so look in both places.

  • Compare WordPress with its official files: wp core verify-checksums in WP-CLI does it for the core, and the same check for plugins from wordpress.org is wp plugin verify-checksums --all.
  • Look for PHP files where none belong: the uploads folder, wp-includes and wp-admin.
  • Sort files by the date they changed and look at what changed on the day the problem began.
  • Check .htaccess, wp-config.php, the mu-plugins folder, scheduled tasks and the users list.
  • Search posts and options for injected scripts and spam links.

A scanner does the same work faster. The Antivirus of Baza Helper Pro scans files and the database, compares WordPress and plugins with their official files, and moves a suspicious file to quarantine that you can undo. It is not a firewall and it finds what is already on the site, so use it together with the steps here. See the WordPress antivirus plugin page for what it checks.

Clean the site

  1. Put the official WordPress files back (reinstall the core) and reinstall every plugin and theme from its official source.
  2. Delete plugins and themes you do not use, and anything abandoned or pirated.
  3. Remove the files that do not belong, after you have kept a copy of them.
  4. Clean the posts and options that contain injected code.
  5. Scan again. Repeat until nothing new appears.

Close the hole

  • Update WordPress, plugins and themes. An outdated plugin is the way in more often than anything else.
  • Turn on two-step login for administrators and limit login attempts.
  • Give every person only the role they need.
  • Keep backups on a place that is not on the same server, and test that you can restore one.
  • Watch for changes: a scan on a schedule and an alert when a file changes.

Ask Google to review the site

If Google warned about the site, open Search Console, go to Security issues and press the button to request a review after the site is clean. Review takes some days. To see whether any malicious code is left after cleanup, follow how to check WordPress for malware.

To go through the checks in more detail, read how to check a WordPress site for malware.

When to ask for help

If the infection returns, you cannot find the way in, or the site earns money and every hour counts, ask for help. Our WordPress security service and WordPress troubleshooting cover this work, and a person goes through the result with you. No tool or service can promise that a site will never be infected again; the aim is to find the way in, clean the site and lower the risk.

Find malware before your visitors do

Baza Helper Pro scans your files and database for malware, compares WordPress and plugins with their official files and watches code changes while the site runs. A suspicious file goes to quarantine and comes back in one click.

  1. 01

    Scans every file and the database

  2. 02

    Compares with the official files

  3. 03

    Quarantine and restore in one click

Written by