Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages

Help for owners

My WordPress site sends visitors to casino or spam websites

Short answer

A site that sends some visitors to spam pages has almost certainly been compromised. Google describes this as a hacked-content redirect that may depend on the visitor's referrer, device or browser, so you may never see it yourself. Do not delete files at random. Secure access, keep a copy, and have the injected code and the way in removed.

  • Written for business owners
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Does this sound like your situation?

  • Customers say my site opens a casino, pharmacy or adult page.
  • It only happens when coming from Google, or only on a phone.
  • I open my own site and it looks normal.
  • Google shows a warning, or the search results show strange titles for my pages.
  • New admin users or unknown plugins appeared.

Why does this happen?

  1. Injected code that only some visitors trigger

    Google's spam policy lists redirects among the types of hacking: injected code that sends some users to spammy pages depending on referrer, user agent or device. It notes that a link clicked in search results may redirect while visiting the address directly does not.

  2. An outdated plugin, theme or WordPress itself

    WordPress's hardening guide says older versions are not maintained with security updates and that exploit details become public once a fix is released, so outdated sites are more exposed. It also advises deleting plugins you do not use.

  3. Weak or reused admin passwords

    The same guide advises long, mixed passwords not based on your name or site name, and two-step authentication as an extra layer. A guessed or leaked login is enough to add code.

  4. Plugins or themes from untrusted sources

    The guide says to get plugins and themes only from trusted sources. Copies from unofficial download sites are a frequent way in.

  5. The first fix is removed but the way in stays

    Cleaning one file while the hole stays open lets the infection return. Hidden extra users or backdoor files are the usual reason the redirect comes back.

What can I do about it today?

  1. Do not click the redirecting links yourselfSpam pages can be harmful. Do not test on a work computer. A developer can check safely from a controlled setup.
  2. Ask the host for a copy of the site and the logsBoth the files and the database. WordPress's own guidance stresses regular backups and logs, because logs can show how the attack happened.
  3. Change passwords from a clean computerAdmin logins, hosting, FTP and the database. Start with hosting, then WordPress. Remove users you do not recognise only after the copy is made.
  4. Do not delete files or reinstall in a hurryDeleting the wrong thing can break the site and also erase the traces needed to find the way in.
  5. Warn your teamTell staff not to log in from shared computers, and tell customers on a separate channel if the redirect leads to anything asking for details.
  6. Check Google Search ConsoleIf the site is verified, look at its Security Issues report. Google says to be sure the problem is truly fixed before requesting a review.

When should I bring someone in?

  • Right away. A redirect to spam is a live compromise, not a styling problem.
  • Google or the browser shows a warning for the site.
  • The redirect came back after you or the host cleaned it once.

How do I handle it?

  1. Preserve a copy firstFiles, database and logs are saved before cleanup so the evidence and the way back are kept.
  2. Find what was injectedCore files, plugins, themes, the database and server config are compared against clean copies from official sources.
  3. Find the entry pointLogs, user lists and plugin versions are read for how the attacker got in, whether through a plugin, a password or the host.
  4. Clean and closeInjected code and hidden users are removed, software is updated, passwords and keys are replaced, and unused plugins are deleted.
  5. Verify and reportI test from the conditions that triggered the redirect and help prepare the review request that Google's page describes.

The price depends on what I find, so I quote in writing after a short discovery call. Tell me what is happening and I reply within 24 hours.

What do owners ask about this?

Why does my site look fine to me?

Google notes that this kind of redirect can depend on referrer, user agent or device, so the owner who types the address often sees nothing.

How long does Google take to remove the warning?

Google's page says malware reviews take a few days and hacked-spam reviews can take several weeks. The decision is theirs, so I cannot promise a date.

Can a plugin remove it for me?

A scanner can help find files, but it does not tell you how the attacker got in. Without closing that, the redirect tends to return.

Should I restore an old backup?

Only a backup made before the compromise is useful, and it must be updated and secured afterwards. Otherwise you restore the same weakness.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Found a mistake? Tell me.

Next step

Want this off your desk?

Send me a few lines on where things stand. I reply within 24 hours.