rawatweb

WordPress Pharma Spam with a Normal Homepage: How to Investigate

A normal-looking homepage does not rule out hidden pharma spam. Safely inspect URLs, content, the database, files, redirects, and access in order.

Editorial comparison of a normal-looking WordPress homepage and hidden pharmacy spam URLs found through logs and database checks.

You search for your own domain and find URLs containing medicine, prescription, or pharmacy terms that you never published. Yet the homepage looks normal when you open it. This can happen because spam was added to a new page or database record, hidden in another template, or shown only under specific request conditions. Removing the URL from Google without finding its source can let the same page return.

The quick answer: do not treat a normal homepage as proof that the site is clean. Record sample URLs, status, time, and Search Console reports; do not open a page that may phish or deliver a harmful download. Distinguish comment/user-generated spam from an attacker’s injection, inventory WordPress content and accounts, inspect files/redirects/cron/database and logs, and identify the process creating the spam. Remove the source and weakness first; handle indexing and reviews after the site has been verified.

Why can the homepage look normal?

Pharma spam can live in new posts or pages, custom post types, attachments, comments, database options, template files, scripts, or URLs assembled by rewrite rules. An attacker may show it only when a request comes from a search engine, a particular referrer, a mobile browser, or a logged-out visitor. Google explains that hacked content can involve new spam pages, hidden content, injections on existing pages, or redirects that depend on referrer, user agent, or device (Google Spam policies). The homepage seen by an administrator represents one request—not the whole site.

The label “pharma spam” also needs context. A pharmacy or clinic may publish legitimate content; not every page containing a medicine term is a compromise. Look for stronger indicators: an unfamiliar URL or title, an author who does not own the content, a foreign redirect, hidden links, bulk-created posts, code that does not belong, or a Search Console security finding. Do not delete legitimate pages just because the term appears in a search result.

Preserve evidence and limit visitor risk

Before cleanup, export sample URLs from Search Console or customer reports, and record the date, time, page status, source, and URL pattern. Preserve relevant logs, database, files, and configuration in a private location. Redact customer data, tokens, cookies, and email addresses. If a URL redirects to an illegal pharmacy, phishing, or malware site, ask the host to restrict access; do not ask customers to click it as proof.

Use a clean browser and a logged-out profile only when necessary to inspect a safe URL. Do not automatically follow redirects or enter credentials on an unfamiliar page. If payments, personal data, or administrator access may be affected, contact the host and security team promptly. Snapshot the site before changing .htaccess, plugins, themes, or the database; undocumented edits make the root cause harder to trace.

Distinguish user-generated spam from a hacked site

  1. Identify the content type. Spam limited to comments may come from a public form that needs moderation or anti-abuse controls. New posts/pages, unfamiliar accounts, hidden scripts, and redirects point more strongly to a compromise or abused access.
  2. Check who created the object. Record the post author, user ID, date, status, post type, slug, revisions, and role changes. A long-standing account can still be compromised; a familiar name is not proof of legitimate activity.
  3. Compare against approved publishing channels. Frontend submissions, marketplaces, membership sites, and integrations can create custom post types. Ask the business owner before deleting data.
  4. Check every locale, domain, and subdomain. Spam may be on an infrequently visited path, old page, campaign subdomain, or mobile version. Do not stop when one site: result disappears.
  5. Correlate the finding with logs and access. Look for a request, login, upload, plugin change, cron event, or deployment near the creation time. If evidence points only to user-generated content, fix validation and moderation; if unauthorized access appears, start a compromise response.

Google distinguishes spam added through user-generated content from content placed without permission because of a security weakness. For the comment case, see our guide to WordPress comment spam versus a compromise. If WP-CLI is available, read-only commands such as wp post list --post_type=any --post_status=any --fields=ID,post_type,post_status,post_title,post_name,post_date and wp user list --role=administrator can help build an inventory; see the official wp post list and wp user list documentation. Run them on an isolated copy and protect the output. Do not run bulk deletion commands.

Audit every place that can store spam

Content and database

Inventory posts, pages, attachments, custom post types, comments, revisions, users, usermeta, options, widgets, menus, and custom HTML. Look for unfamiliar slugs or titles, hidden anchors, scripts, changed canonicals, unapproved pharmacy URLs, and content that appears only after a template processes the data. On a database copy, use search tools that understand table prefixes and serialized values. Record matching IDs and fields; do not run broad DELETE queries based on one word, which can destroy legitimate content or serialization structure.

Files, plugins, and themes

Compare core files with official checksums using wp core verify-checksums; use wp plugin verify-checksums --all for supported WordPress.org plugins where appropriate. Review themes, mu-plugins, drop-ins, uploads, new or changed PHP files, .htaccess, .user.ini, wp-config.php, and files in directories expected to hold only media. Checksums do not cover the entire application; premium/custom plugins and the database need other comparison sources. For an unfamiliar PHP file in uploads, preserve evidence, do not open its URL, and ask the host whether that path can execute scripts.

Redirects, cron, and services outside WordPress

Compare a direct response with a request under relevant conditions on staging; record Location without opening an unfamiliar destination. Review the CDN/WAF, DNS, server rewrite rules, service worker, tag manager, scheduled tasks, WordPress cron, backup jobs, and deployments. Use wp cron event list for WordPress events, then ask the host to inspect system cron and logs outside your access. If a redirect appears only from a certain referrer, do not open the unfamiliar destination; ask the host to review the first response and edge/origin logs. Do not assume every redirect is legitimate because the homepage looks normal.

Build a URL inventory from multiple sources

Start with sources you can explain: Search Console examples, the XML sitemap, internal routes, post/page/custom-post-type inventories, access logs, and customer reports. Label each URL “known good”, “suspected spam”, “redirect”, or “not checked”, and assign evidence and an owner for verification. Do not crawl aggressively on an overloaded site or without the host’s approval. For each path group, select different samples—the homepage, new URLs, older pages, mobile output, and query-string variants—and compare the first response without following an unfamiliar destination.

WP-CLI inventory output can contain titles, slugs, email addresses, and user IDs. Run it only through an authorized operator on a private copy, limit the collected fields, and remove personal data from handoff notes. If an integration created the content, confirm its hook, API key, and business owner before deletion. If you cannot distinguish spam from a legitimate product catalog, mark it unverified and ask for confirmation instead of guessing.

Remove the spam after stopping the process that creates it

A safe order is usually: isolate harmful URLs; preserve evidence; revoke unauthorized accounts/tokens/sessions; fix or replace the component that enabled entry; remove backdoors and persistence; restore legitimate pages and options from a trusted backup; then recheck URLs and logs. Rotate passwords from a clean device and include hosting, SSH/SFTP, database, CDN, DNS, and third-party accounts that can modify the site—not just WordPress credentials.

Check whether spam has copies in cache, CDN, backups, sitemap, feeds, internal search, or another platform. Purge cache after fixing the source, not instead of cleanup. Test several URLs through anonymous browsers and different devices in a controlled way. If a file or page returns, identify the process that recreates it instead of deleting the symptom again. Our guides to malware warning signs and recovering a hacked WordPress site can extend the incident response.

Deal with Google after the website is clean

Check Search Console Security Issues for categories and example URLs, and inspect Manual Actions separately if there is a spam-policy notice. Google asks owners to fix all reported issues and describe what they changed when requesting a review; a review does not replace investigation (Security Issues report). If spam URLs remain in search, the Removals tool may reduce visibility temporarily but does not remove a file, post, or entry point from the website. Once the source is clean, use URL inspection, a sitemap, and indexing requests as needed without promising a processing date.

Document the number of URLs found, Search Console categories, root cause, patch/restore date, revoked credentials, files/database reviewed, redirect tests, and any checks still outside scope. Request review only when the samples and other risky areas have been handled and the verification can be repeated. If a new finding appears after review, resume the investigation; do not hide it with another removal request.

Prevent the spam from returning

Limit roles and public registration; require MFA for administrators; remove vendor accounts after work ends; update components from official sources; audit unused plugins/themes; restrict upload types and permissions; keep tested off-site backups; monitor file and account changes; and retain access logs outside directories the application can modify. Define a hosting escalation route and who can approve cleanup. For public comments or submissions, use risk-based moderation and rate limits without breaking legitimate business features.

Mistakes that commonly prolong an incident

  • Removing Google URLs while leaving the post, file, redirect, or account that created the spam active.
  • Concluding there is no hack because the homepage looks normal or one Google result disappeared.
  • Deleting every post containing a pharmacy term without checking that it is legitimate business content.
  • Assuming every spam comment means the server was hacked, or assuming every spam page is just a comment problem.
  • Running broad SQL against the live database without a backup or understanding of serialized data.
  • Repeatedly requesting a review before fixing the root cause, or promising when indexing will recover.

Does pharmacy spam in Google prove WordPress was hacked? Not by itself; it may come from public contributions or legitimate content. But unfamiliar URLs/accounts, redirects, or file/database changes should be treated as serious indicators until verified.

Why can’t I see spam on the homepage? It may be on a new URL, another template, a cached copy, or appear only for a particular referrer/device. The homepage is one route, not a full inventory.

Can I use Google Removals first? It may help temporarily reduce visibility where appropriate, but clean the source on the website and close the weakness first. Removal is not permanent remediation.

When should I contact the host? Immediately if visitors are redirected to phishing/malware, the database or payments may be affected, files return after deletion, or you lack the logs and isolation needed to investigate safely.

If unfamiliar pharmacy pages appear while the homepage looks normal, request emergency website help to map content, access, files, and persistence before bulk deletion.

#WordPress pharma spam #hidden pages #hacked website #incident response
Let's talk about your website

Does any of this look like your website?

Tell us on WhatsApp. We look first, explain what needs fixing, then you decide. For a fuller picture, request the free audit.

Chat with us