BlogGuides · October 13, 2026 · 5 min read

Contact Form 7 Disallowed List: Block Precise Spam Patterns Without Broad Rules

Understand CF7 disallowed keys, literal matching, shared WordPress settings and false positives. Review one justified rule with synthetic verification cases.

A green gate separates mint cards from a card with an orange mark while a magnifying glass inspects the accepted path.
Conceptual illustration; not a product screenshot or measured result.

Contact Form 7 can use WordPress’s Disallowed Comment Keys to treat matching submissions as spam. This is useful when a repeated unwanted phrase or a well-understood source keeps reaching the form. It also creates a predictable false-positive risk: a broad fragment can occur inside a perfectly legitimate message.

The practical goal is a small, reviewable list backed by specific evidence. This guide explains where the setting lives, what the current CF7 implementation checks, how to verify a candidate entry and how to recover when an innocent inquiry is blocked. It does not propose replacing all other spam protection with keyword matching.

Understand the shared setting

The official disallowed-list guide places the control in Settings > Discussion > Disallowed Comment Keys. Entries are separated by lines. CF7 consumes this WordPress setting for form spam decisions, even though the administration screen describes comments.

That means the change deserves coordination with whoever manages comments and other forms. A rule intended for one landing page can affect more than that page. If only one form should reject a business-specific value, consider a scoped validation rule instead; our custom-validation guide covers that different requirement.

Before editing, save the existing text in a private change note and identify the requested addition. Keep the list’s previous value available for a targeted reversal. Do not erase the existing list, replace it with an unreviewed public blacklist or add hundreds of speculative terms.

Know what the current matcher sees

The current CF7 disallowed-list module assembles posted field values, remote IP metadata and user-agent metadata into its matching target. It reads the shared disallowed_keys option and checks literal, case-insensitive patterns. It does not offer whole-word boundaries in this setting.

Consequently, a fragment such as sale can also occur in wholesale. A pattern that looks like a regular expression is not a supported way to express advanced matching: the implementation quotes entries before building its pattern. Current source also skips entries shorter than two bytes or longer than 256 bytes. Recheck these implementation details if your installed version differs.

Those details change how you design a test. Put the candidate term in the message, then inside a longer legitimate word, then in a different field. A rule that appears narrow in the visible message may be broad once all posted values are considered.

Choose one candidate from observed spam

Use a repeated distinctive phrase, not a common industry word. As a fictional example, suppose several unwanted messages contain example-junk-offer.invalid. That exact distinctive fragment is a more reviewable candidate than “offer,” “business” or “marketing.” The fictional domain is for illustrating a test and should not be added to a live list as if it were an observed attacker.

Write a one-sentence reason: what repeated evidence justifies this entry, which messages it should match and which similar legitimate messages it must allow. If you cannot describe those cases, collect better evidence before creating the rule. A keyword list becomes hard to maintain when nobody remembers why each line exists.

Keep personal data out of shared notes. You may need a restricted operational record to diagnose a particular incident, but an ordinary editorial checklist should use synthetic examples. Avoid retaining full inquiry bodies merely to justify a phrase match.

Verify on a staging copy

  1. Record the previous list and confirm the existing form sends normal synthetic messages.
  2. Add only the proposed candidate to the staging setting.
  3. Submit a message containing that exact candidate.
  4. Submit a normal message with no candidate.
  5. Submit a legitimate word or phrase containing a similar fragment.
  6. Review the spam reason where your configured logging makes it available.
  7. Remove the candidate and verify the former blocked example behaves differently.

This sequence tests both the rule and your ability to reverse it. It is a suggested procedure, not a claim that we ran these cases against your site. Avoid real customer addresses or triggering normal lead automations during the verification.

Read the outcome rather than relying only on border color. Theme styling can change. CF7’s spam-response explanation recommends examining spam logging to distinguish the responsible module. Our spam-reporting guide explains why a total spam count cannot identify the cause of an individual rejection.

Treat IP entries cautiously

An IP is not a permanent identity. Shared networks, changing addresses and proxy configurations can make it a poor basis for a durable decision. Before adding an address, establish what the installation records as the remote IP and whether that value identifies the client you intend to block.

CF7’s special mail-tag [_remote_ip] can expose its recorded value in a notification; the special-mail-tag guide discusses contextual metadata. Do not publish that data or casually alter proxy trust settings to obtain another value. When the source identity is uncertain, prefer a narrower content rule or professional review of the actual spam-protection configuration.

Recover from a false positive

If a legitimate inquiry is blocked, identify the matching entry and remove or narrow that one entry. Retest the innocent example and the original spam pattern separately. Preserve the incident’s cause in a restricted note so the same broad rule is not reintroduced next month.

Do not assume a blocked message produced ordinary notification mail. Contact Form 7 classifies a matching submission as spam. If you need reviewable records, choose and verify a separate storage workflow with appropriate access and retention; see saving submissions with Flamingo. Storage behavior depends on the installed tools and is not guaranteed by the disallowed-list setting.

Maintain a small list

Review entries after a reported false positive and whenever the site’s audience or forms change. Give each rule an owner, rationale and review date. An old term that no longer explains any observed spam can continue blocking inquiries long after its original purpose disappeared.

For ongoing submission visibility, review our free Svetlik Analytics plugin and compare its documented fields with your reporting needs. Reporting helps investigate outcomes; it does not make a broad blacklist precise. Begin with one justified entry and the normal-message checks above.

Sources