search

How to Configure Cloudflare Turnstile with Contact Form 7

Contact forms are magnets for spam bots. The usual fix is Google reCAPTCHA, but it adds friction for real visitors and hands their data to an ad network.

Cloudflare Turnstile is a free, privacy-friendly alternative. It confirms a visitor is human without puzzles, and since version 6.1, Contact Form 7 supports it natively, so you do not need an extra plugin.

The part people get stuck on is the setup in Cloudflare: creating a widget and finding your Site key and Secret key. This short guide walks through exactly that, then connects the keys to Contact Form 7.

Why Use Cloudflare Turnstile?

Turnstile is Cloudflare’s bot-detection widget. It runs lightweight checks in the background instead of asking visitors to click traffic lights or read blurry text.

Cloudflare describes Turnstile as a free, privacy-first alternative to CAPTCHA, one that verifies visitors are real people without the frustrating image puzzles or the tracking that ad-network CAPTCHAs rely on.

If you already protect forms with Google reCAPTCHA on Contact Form 7, Turnstile is a lighter, more private swap. You can read more on the official Turnstile page.

What You Need

Setup is quick, but a couple of pieces have to be in place first.

  • A free Cloudflare account. You do not have to move your DNS or site onto Cloudflare to use Turnstile. A basic account is enough.
  • Contact Form 7 version 6.1 or newer. Native Turnstile support landed in 6.1. On older versions you would need a separate plugin, so update Contact Form 7 first.

Step 1: Create a Turnstile Widget and Get Your Keys

Your Site key and Secret key are generated when you create a Turnstile widget in the Cloudflare dashboard. This is the main step, so take it slowly.

Sign in to the Cloudflare dashboard, open Turnstile from the sidebar, and click Add widget. Give the widget a name you will recognize later, then add your site’s domain under Hostname Management.

Cloudflare Turnstile Add Widget screen showing the widget name field and Hostname Management for adding your domain

Next, choose a widget mode. Managed is the recommended option: Cloudflare picks the verification method based on risk, so most visitors pass without doing anything. Non-interactive shows a short spinner, and Invisible runs with nothing on screen.

Cloudflare Turnstile widget mode options: Managed, Non-interactive, and Invisible, with Managed recommended

Click Create. Cloudflare immediately shows the two keys you came for.

  • Site key is public. It renders the widget in the visitor’s browser.
  • Secret key is private. Your server uses it to validate each response with Cloudflare.
Cloudflare Turnstile Site key and Secret key displayed after creating the widget

Copy both keys. If you close the screen, you can reopen the widget from the Turnstile list to view them again.

Treat the Secret key like a password: it belongs only on your server. Never paste it into page HTML, a public repository, or client-side JavaScript. Only the Site key is meant to be visible in the browser.

Step 2: Add the Keys to Contact Form 7

With both keys copied, the WordPress side takes under a minute. Contact Form 7 has a built-in Turnstile module, so there is nothing else to install.

In WordPress admin, go to Contact, then Integration. Find the Cloudflare Turnstile panel and click Setup Integration. Paste your Site key and Secret key into their fields and save.

That is the whole connection. Every contact form on your site now shows the Turnstile widget above its submit button and validates each submission before it sends, with no form-tag to add per form. For the official reference, see the Contact Form 7 Turnstile documentation.

Turnstile pairs well with your existing defenses. You can keep Akismet running on Contact Form 7 to filter message content while Turnstile blocks the bots that never reach a human.

Step 3: Test Your Form

Always confirm the connection with a live submission before you move on.

Open a page with a contact form in a private browser window. You should see the Turnstile widget appear before the submit button, or nothing at all if you chose Invisible mode. Send yourself a test message.

If the message arrives, the keys are working. If you get a validation error, check that the domain in the page URL matches the hostname you added to the widget in Step 1, since a mismatch is the most common cause.

FAQs

Common questions about setting up Cloudflare Turnstile with Contact Form 7:

Do I need to move my site to Cloudflare to use Turnstile?
No. Turnstile works on any site with just a free Cloudflare account. You do not have to change your DNS or route your traffic through Cloudflare to generate and use the keys.
Which Contact Form 7 version supports Turnstile natively?
Native Turnstile support was added in Contact Form 7 version 6.1. On that version or newer, you set it up under Contact then Integration. On older versions you would need a separate Turnstile plugin, so update Contact Form 7 first.
Is Cloudflare Turnstile free?
Yes. Turnstile is free to use for standard web forms, with no per-verification charge. That is one of its main advantages over paid or usage-limited CAPTCHA services.
What is the difference between the Site key and the Secret key?
The Site key is public and renders the widget in the visitor's browser. The Secret key is private and stays on your server, where it validates each response with Cloudflare. Contact Form 7 needs both, but only the Secret key must be kept confidential.
The Turnstile widget is not showing or gives a domain error. Why?
The usual cause is a hostname mismatch. The domain serving your form must match a hostname you added to the widget in Cloudflare. Add the exact domain, including any staging or www variant you use, then reload the form.
Can I run Turnstile and reCAPTCHA at the same time?
There is no benefit to running both, and stacking two CAPTCHAs only slows the form down. Pick one. Turnstile is the lighter, more private option, so most sites switch from reCAPTCHA to Turnstile rather than combine them.

Summary

Cloudflare Turnstile gives Contact Form 7 free, privacy-friendly spam protection without the friction of traditional CAPTCHAs.

The core of the job is getting your keys: create a Turnstile widget in the Cloudflare dashboard, add your domain, and copy the Site key and Secret key. Then paste them into Contact Form 7 under Contact, Integration, and save.

Keep the Secret key private, send yourself a test message to confirm it works, and your forms are protected.

Join the Discussion
0 Comments  ]

Leave a Comment

To add code, use the buttons below. For instance, click the PHP button to insert PHP code within the shortcode. If you notice any typos, please let us know!

Savvy WordPress Development official logo