跳到内容

SWOT Form Spam Protection

v1.0.0

jiepei · 2026年11月26日 上架

Self-hosted anti-spam for Contact Form 7 and WPForms: image captcha, honeypot, time trap, rate limit and IP blocking. No Google reCAPTCHA.

正在使用
10 以下
评分
暂无
累计下载
0
最近更新
2026年11月26日
需要 WordPress 6.2+已测试到 7.1.5PHP 7.4+

贡献者

SWOT Form Spam Protection for Contact Form 7 and WPForms protects Contact Form 7 and WPForms forms from spam bots without Google reCAPTCHA, API keys, accounts or third-party scripts. Everything runs on your own server.

Protection layers

Every submission is checked on the server, in this order:

  1. IP block list – blocked IP addresses are refused straight away.
  2. Honeypot – a hidden field with a per-site random name. Bots fill it in, people do not.
  3. Rate limit – a maximum number of submissions per IP address in a time window.
  4. Single-use token – each captcha is issued by AJAX and can be used only once.
  5. Interaction check – JavaScript confirms real keyboard, mouse or touch activity.
  6. Time trap – forms submitted faster than a person could are rejected.
  7. Image captcha – drawn with PHP GD. If GD is not available, a simple maths question is shown instead.

IP tracking and blocking

  • Every submission attempt is recorded with its result.
  • See which IP addresses submit most often and block them with one click.
  • Optional automatic blocking after repeated failed attempts.
  • Whitelist your own IP address. Local and private addresses are never blocked.
  • Old records are deleted automatically (30 days by default).

Supported form plugins

  • Contact Form 7
  • WPForms

How to add the captcha

Contact Form 7: edit the form and add [cfcap_captcha] where you want the captcha, for example above the submit button.

WPForms: add a Content or Custom HTML field containing the shortcode [cfcap_captcha], or enter the form ID under Settings > SWOT Form Spam Protection and the captcha is added automatically above the submit button.

Optional credit label

A small “Protected by SWOT” label, linking to https://swot.com.my, can be shown under the captcha. It is off by default. Turn it on under Settings > SWOT Form Spam Protection > “Credit label”. To override it for a single form, use [cfcap_captcha brand="on"] or [cfcap_captcha brand="off"] (in Contact Form 7: [cfcap_captcha brand:on]).

Privacy

When a visitor submits a form protected by this plugin, the plugin stores the visitor’s IP address, browser user agent, the form ID and the result (passed or blocked) in your own WordPress database. Records are deleted automatically after the retention period you choose (30 days by default). IP addresses on the block list stay until the block expires or you remove them. No data is sent to any external service. Suggested privacy policy text is added under Settings > Privacy.

For developers

  • cfcap_render_image() – draws the captcha image (replace or tune to change difficulty).
  • cfcap_messages filter – change visitor-facing messages.
  • cfcap_alphabet filter – change the characters used in the code.
  • cfcap_client_ip filter – return the real visitor IP when the site is behind a proxy or CDN.
  • cfcap_skip_private_ips filter – return false to allow blocking of private addresses.

Plums

按场景查找 WordPress 插件。安装量、评分和兼容版本来自官方目录。

导航

说明

WordPress 是 WordPress Foundation 的商标。本站与 WordPress Foundation、Automattic 没有隶属关系。这里不托管插件文件,下载和安装以 WordPress.org 上的页面为准。

© 2026 Plums