Malware on a WordPress website is one of the most common reasons business owners call us in a hurry. The website suddenly redirects customers to suspicious sites, Google shows a red warning, and the hosting provider suspends the account. In this guide we explain how to recognise an infection, how to remove malicious code safely and what to do so that the problem does not come back.
Why are WordPress websites attacked?
WordPress powers a huge part of the internet, which makes it a popular target for automated attacks. The core itself is patched regularly, but most hacks exploit outdated plugins and themes, weak passwords or abandoned copies of websites on the same server. Bots scan the internet non-stop and attack every website running vulnerable software – whether it is a large store or a small company’s one-page site.
Signs that your WordPress website has malware
- visitors are redirected (often only on mobile or only from Google results) to sites with ads, gambling or fake prizes,
- the “This site may harm your computer” message in Google or a warning in the browser,
- pages with foreign-language spam that you never created appear in search results,
- unknown administrator accounts, PHP files in the uploads folder or modified theme files,
- the hosting provider suspends the account or blocks outgoing email because of spam,
- the website suddenly slows down and the server uses unusually high resources.
How to check your website yourself
As a first step, check the “Security issues” report in Google Search Console, review the list of users in the WordPress dashboard and compare file modification dates on the server. Keep in mind, though, that malicious code is often obfuscated and hidden in the database, so the absence of visible symptoms does not mean the website is clean.
How to remove malware from a WordPress website – a safe process
1. Preserve the current state of the website
Before you delete anything, make a full backup of the files and database. This copy is used for analysis and lets you undo changes if something goes wrong. Also change the password to your hosting panel and FTP.
2. Scan files and the database
Security scanners help point out suspicious files, but they do not replace manual analysis. Among other things we look for functions such as eval, base64_decode, foreign files in the wp-content/uploadsfolder, a modified .htaccess file and scripts injected into the content and options tables.
3. Replace the core, themes and plugins with clean versions
The most reliable method is to reinstall WordPress, themes and plugins from official sources. Remove add-ons you do not use – every unused plugin is a potential back door.
4. Change passwords and keys
Change the passwords of all administrators, the database and email, generate new security keys in the wp-config.php file and remove unknown user accounts.
5. Find and close the vulnerability
Removing the effects without finding the cause usually ends with reinfection a few days later. Analysing the server logs helps establish which plugin or account was used for the attack.
6. Ask Google for a review
Once the website is clean, request a review in Google Search Console. After a successful review the warning for visitors is removed.
How to protect WordPress against another attack
- update WordPress, plugins and themes regularly – ideally after taking a backup,
- use strong, unique passwords and two-factor authentication,
- limit login attempts and hide the default login URL,
- keep automatic backups outside the website’s server,
- use a web application firewall (WAF) and file change monitoring,
- do not install “free” copies of premium themes from unofficial sources.
You will find more recommendations in the official Hardening WordPress.
When should you hand the clean-up to a specialist?
If the website sells, collects customer data or has been flagged by Google as dangerous, every hour of delay costs money. An experienced specialist will find hidden backdoors and the cause of the hack faster, and after the clean-up will put security measures in place. At HashtagIT we have been doing WordPress malware removalfor years, and as part of our ongoing website care we make sure the problem does not come back.
