Description
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.
Installation
- Upload the plugin folder to
/wp-content/plugins/, or install it from the Plugins screen in WordPress. - Activate the plugin.
- Contact Form 7: edit a form and put
[cfcap_captcha]where the captcha should appear (for example above the Submit button), then save. - WPForms: add a Custom HTML (or Content) field containing
[cfcap_captcha], or enter the form ID under Settings > SWOT Form Spam Protection. - Optional: open Settings > SWOT Form Spam Protection to adjust the checks, add your IP to the whitelist and manage blocked IPs.
FAQ
Does it need Google reCAPTCHA or any API key?
No. Everything is generated and checked on your own server.
Does it need the PHP GD extension?
GD is used to draw the image. Without it, the plugin shows a simple maths question instead.
The captcha does not load and shows an error.
Your IP address may have been blocked by the automatic blocking after several wrong answers. Open Settings > SWOT Form Spam Protection, remove the IP from the Blocked IPs list and add it to the whitelist.
The plugin sees the same IP address for all visitors.
Your site is probably behind a proxy or CDN. Use the cfcap_client_ip filter to return the real visitor address from the header your proxy sets.
Where can I see blocked attempts?
Under Settings > SWOT Form Spam Protection.
Is any data sent to other websites?
No.
What happens when I delete the plugin?
Deleting the plugin from the Plugins screen removes its settings, database tables (submission history and blocked IPs) and scheduled task.
Screenshots
Changelog
1.0.0
- First public release.

