How to Tell If Your WordPress Site Has Been Hacked

How to Tell If Your WordPress Site Has Been Hacked

Reading time
11 min
Published
Last updated
In this post

Many hacked websites keep working normally. They look the same, load the same and their owner suspects nothing for weeks or months. Attackers who live off your website do not want you to notice, because the more time passes, the more profit they make from it. That is why the signs are usually subtle and appear in places people do not usually look.

A site search reveals spam pages under your domain

In this article you will see the most reliable signs of an intrusion, grouped by where they appear, from what your visitors see to what is in your dashboard and on your hosting. Also the tests you can carry out in ten minutes without technical knowledge, how to interpret them without becoming unduly alarmed and what to do when you find nothing but still have doubts. At the end there are commands for anyone who prefers to check with code.

Why a WordPress hack goes unnoticed

An experienced attacker designs their intrusion to go unnoticed. They limit what is shown to whoever administers the site, act only with certain visitors, hide their files among the legitimate ones and avoid doing things that draw attention, such as breaking the website. If it is noticed, they will lose it.

Moreover, many symptoms have other causes. A slow website may be due to a heavy plugin, and a drop in visits to a change at Google. That is why the key is not an isolated sign but several that coincide.

A single one may be coincidence. Three or four together almost never are.

Studies by security companies agree that a high proportion of owners of hacked websites did not know they were hacked when they were told. Some infections have been active for months, and detection comes through a warning from Google, a customer or the hosting provider, not from the owner. That is why it is best not to wait for symptoms. A security plugin with daily scanning, Search Console with alerts enabled, file monitoring and a monthly review of users and plugins bring the warning forward from weeks to hours. The best way to know whether you have been hacked is to have something that tells you in time.

Four months between the intrusion and discovering the hack

External signs of a hacked WordPress site

Redirects and content you did not write

The clearest are redirects, when opening your website or one of its pages takes the browser to another address. Pop-ups or notices you have not added, especially those saying your computer is infected or asking for permission to send notifications. Browser security warnings, with a red screen indicating that the site is dangerous.

Also content you did not write, such as text on another subject, new links in the footer, unknown pages or images that are not yours. Sometimes only visitors arriving from a search engine or those using a mobile phone see it. That is why you have to test from several places, not just from your usual computer.

Spam and strange results in Google

Type into Google the word site, a colon and your domain without spaces. You will see the pages Google holds for your website. If titles you do not recognise appear, addresses with odd extensions or far more pages than you have, there is someone else’s content indexed.

Casino and pharmacy pages nobody created on your site

Then try adding typical spam words, such as casino, betting, pharmacy or loans. Also look at how your website appears when searching for its name and whether the text accompanying the title matches your content. And go into Search Console, where the performance report shows the queries you appear for and the security report may flag a problem.

Browser and antivirus warnings

If your antivirus or your browser warns that your own website contains dangerous software, do not ignore it, even if you see nothing. It may be a false positive, but it may also be code that only activates for some visitors. Check the address in the Google Safe Browsing transparency report and in services that combine many scanning engines. Another clue is your visitors telling you that odd things appear when they visit. A customer telling you that their antivirus is complaining, or that a download pops up, is often the first real sign the owner receives. Take it seriously and ask them for details, with a screenshot if possible.

Bounces and emails you did not send

A hack often leaves traces in email. Bounces of messages you did not send, warnings from your hosting provider about bulk sending, emails from your contacts asking about strange messages that appear to be from you, or your own emails suddenly landing in spam. It is the sign that someone is using your server or your domain to send mail.

Also WordPress emails you do not expect, such as notices of new users, password changes you did not request or login attempts. Check the spam folder and the security plugin’s alerts. If your website sends notification emails, a change in their behaviour is a clue.

Clues inside the dashboard, the server and the database

Unknown users, plugins and content in the dashboard

Go into the dashboard and check the basics. The user list, looking for administrators you do not know. The plugin list, looking for one you do not remember installing, with a generic name or an odd version. The installed themes, in case there is an unknown one. The general settings, where the site address or the administrator email may have changed.

Unknown administrator created six days ago

Look at posts and pages sorted by modification date, and at the drafts and private folder, where spam sometimes hides. And at widgets and theme settings, which have boxes for inserting code. Anything you did not put there yourself is a reason to investigate.

Resource usage and hosting warnings

The hosting control panel gives clues that WordPress does not see. Processor, memory or bandwidth usage that shoots up for no reason. New files in folders where there should be none, which can be seen in the file manager by sorting by date.

FTP or email accounts you did not create. Unknown scheduled tasks.

The access logs, which the control panel shows, reveal who visits what. Thousands of requests to the same unknown file, or to files that do not exist, indicate scans or access to backdoors. And warnings from the provider itself, which sometimes detects the problem before you do, deserve an immediate response.

Modified or new PHP files

Files modified without your involvement are the most direct evidence. Sort your website’s folder by modification date and look at what has changed recently. The WordPress core should not change except when you update. PHP files inside the uploads folder should not exist. Look for files with names that imitate system files but with one letter changed, very small files with a single unreadable line and files with dates that do not match any update. The official checksum verification in the WordPress command-line tool detects them in seconds.

wp-l0ad.php, a file mimicking wp-load.php in uploads

Hidden code and users in the database

Some attacks do not touch files. They store their code in the WordPress database, in posts, options or widgets. To detect it, search in phpMyAdmin for script and iframe tags and external domain addresses in post content and in the options table.

Also check the number of posts and users, which may be higher than expected. A users table with rows the dashboard does not show, or thousands of new posts with strange content, are clear signs. The queries in the technical section look for the most common cases, and security plugins with a database scanner automate it.

How to confirm whether your WordPress site has been hacked

Checking from a private window and as Googlebot

Since malicious code hides from whoever administers the site, the most useful test is to look at your website without being you. Open a private window, without being logged in. Use your phone on mobile data instead of your wifi. Arrive from a Google result rather than typing the address. And test several pages, not just the home page.

If you know how to use the command line, you can request your website pretending to be Google’s robot, which is who hidden content is shown to most. The command is in the technical section. Compare what a normal visitor sees with what the robot sees. If it is different, there is code deciding what to show depending on who is looking.

Googlebot sees an extra link a private window does not show

Free scanners and Google Safe Browsing

There are online scanners that analyse an address and look for malicious code, redirects and blacklists. They are fast and require nothing to be installed, although they only see what is shown publicly. Security plugins with a scanner review files and the database from inside, and compare the core with the official versions.

The Google Safe Browsing report, Search Console and services that combine dozens of scanning engines complete the list. Use at least two or three, because none finds everything. A clean result in one and a dirty result in another deserves investigation, not reassurance.

Online scanner detecting malware while blacklists are clean

Scanner false positives

A scanner warning does not always mean infection. False positives are frequent, especially with minified code, plugins that use legitimate obfuscation techniques or files belonging to the security plugin itself. Before deleting anything, look at which file it flags, what exactly the warning says and whether it belongs to a known plugin.

Compare the file with the original version. If it is identical, it is a false positive. If it differs, look at what the difference contains.

A line of obfuscated code or a call to an external server that does not exist in the original is an infection. If in doubt, ask for a second opinion before deleting anything.

Infections that tools do not detect

Some infections are hard to see. If you have clear symptoms, such as strange traffic, Google warnings or spam in the results, and all the tests come back clean, the code is probably hiding from your tests. Repeat them from other devices and networks, and try the Search Console inspection tool, which shows exactly what Google sees. Review the less usual areas, such as subdomains, old folders, test installations and other websites on the same hosting account. And ask your provider to run a scan from their side. If after all that you still have doubts, a professional can carry out a full diagnosis. If you confirm the intrusion and the website matters to your business, a WordPress emergency service can contain the damage while the investigation is carried out.

Commands to confirm an intrusion in WordPress

Comparing the core and plugins with the official versions

With WP-CLI, the WordPress command-line tool, which is used in a terminal connected to your server, you can compare the core and plugin files with the originals and see the administrators. It is the fastest objective test.

WP-CLI, WordPress command line
wp core verify-checksums
wp plugin verify-checksums --all
wp user list --role=administrator --fields=ID,user_login,user_email,user_registered

This Linux command, which you can run in your computer’s terminal, requests your home page pretending to be Google’s robot and a normal visitor, and counts how many external links each one returns. If the numbers differ greatly, the code is showing different content depending on who visits.

Linux commands (terminal)
curl -s -A "Googlebot/2.1 (+http://www.google.com/bot.html)" https://yourdomain.com/ | grep -o 'href="http[^"]*"' | wc -l
curl -s https://yourdomain.com/ | grep -o 'href="http[^"]*"' | wc -l

Listing PHP files modified in the last week

These commands run on the server, in your website’s folder. They list the PHP files modified in the last week and the PHP files inside the uploads folder.

Linux commands (terminal)
find . -name "*.php" -type f -mtime -7 -not -path "*/cache/*" | head -50
find wp-content/uploads -name "*.php" -type f

Searching the database for external script and iframe tags

And this SQL query, for the SQL tab in phpMyAdmin, searches posts and options for script and iframe tags with external addresses, which are the most common traces of code injected into the database.

SQL query
SELECT ID, post_title, post_status FROM wp_posts WHERE post_content REGEXP '<script[^>]+src=|<iframe' AND post_status IN ('publish','draft','private') LIMIT 50;
SELECT option_name FROM wp_options WHERE option_value REGEXP '<script[^>]+src=|<iframe' LIMIT 30;
Frequently asked questions

Frequently asked questions about how to tell if WordPress is hacked

What are the signs of a hacked WordPress site?

Redirects to other websites, pages in other languages in Google, dangerous site warnings in the browser, unknown administrators, new PHP files, spikes in server usage, emails rejected as spam or unexplained drops in traffic.

Can my website be hacked even if it looks fine?

Yes, and it is the most common case. Many infections only show themselves to search engines, to visitors arriving from Google or to mobile users, and hide their content from anyone who is logged in.

How do I check whether Google has detected the hack?

In Search Console, under security issues and manual actions, and on the Google Safe Browsing status page. Also search for your domain in Google to see whether pages you do not recognise appear.

Do online scanners detect whether a website is hacked?

They detect what can be seen from outside, such as malicious scripts, redirects or presence on blacklists. They do not see backdoors in the files or code that only activates under certain conditions, so a clean result guarantees nothing.

What should I check in the WordPress dashboard?

The list of users with the administrator role, the installed plugins, including those you do not recognise, the website address settings and any recent posts or pages you did not create yourself.

How do I check the server files?

By comparing the core and plugins with the official versions, looking for PHP files in uploads and recently modified files, and reviewing .htaccess and wp-config.php. Over SSH this is done with WP-CLI and search commands.

Why is my website suddenly slow?

There can be many causes, but a spike in resource usage without an increase in visits is a warning sign. Some malicious programs mine cryptocurrency, send spam or launch attacks from the server and consume resources.

What do I do if I confirm it has been hacked?

Make a copy of the website in its current state, change all passwords and follow a cleanup plan that includes closing the entry point. If the website matters to your business, it is advisable to get professional help so as not to lose evidence or rankings.

Can a hack affect my domain's email?

Yes. If the website sends spam, the server's IP address and the domain can end up on blacklists, and your legitimate emails will stop arriving or will go to the recipients' spam folder.

About the author

Javier Afán

WordPress developer specialised in security, WooCommerce, and hacked website recovery.

I work on WordPress from a technical angle focused on security, architecture, and the decisions that really affect a project's continuity.

Conversation

0 comments

Add context, experience or useful nuance. Let us keep the conversation clear and helpful for whoever arrives later.

Leave a comment

Your comment will be reviewed before it is published.

Diagnosis

Check whether your website is infected

I can run a full diagnosis of your website, from outside and from inside, with the tests that detect what is hidden from you, and tell you clearly whether it is compromised.