SWOT Form Spam Protection
v1.0.0jiepei · 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日
贡献者
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:
- IP block list – blocked IP addresses are refused straight away.
- Honeypot – a hidden field with a per-site random name. Bots fill it in, people do not.
- Rate limit – a maximum number of submissions per IP address in a time window.
- Single-use token – each captcha is issued by AJAX and can be used only once.
- Interaction check – JavaScript confirms real keyboard, mouse or touch activity.
- Time trap – forms submitted faster than a person could are rejected.
- 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_messagesfilter – change visitor-facing messages.cfcap_alphabetfilter – change the characters used in the code.cfcap_client_ipfilter – return the real visitor IP when the site is behind a proxy or CDN.cfcap_skip_private_ipsfilter – return false to allow blocking of private addresses.