Cloudflare Turnstile - Ninja Forms

Cloudflare Turnstile

Cloudflare Turnstile is a human verification tool that replaces other Captcha options. It’s fine to run Turnstile alongside other anti-spam tools like Akismet. However, you should not run Cloudflare Turnstile and any other Captcha solution together on the same form.

To use Cloudflare Turnstile with your forms, you will need to create and connect to a free Cloudflare account, then add a Turnstile widget to your form(s). Details below.

Connecting your site to Cloudflare Turnstile

1. Login or create a Cloudflare Account

Navigate to Ninja Forms > Settings > Cloudflare Turnstile in your WordPress admin dashboard. Click the link there to get site keys for your domain.

Cloudflare Turnstile site key settings in the Ninja Forms admin

The link will redirect to Cloudflare’s website and prompt you to log in or create an account. You will then be able to access Turnstile settings within your account.

2. Connect your domain to your Cloudflare account

In the Turnstile section of your Cloudflare account, you will be asked to add a hostname. They are looking for the URL of your website minus the https://www. and any paths. For example, in the URL https://www.mywebsite.com/blog, you would only want to give them mywebsite.com as the hostname.

Once your host name is added, you’ll be asked to select your widget mode.

3. Select your preferred widget mode

The widget mode you select here can be changed at any time within your Cloudflare account. The widget mode you select will determine the widget that you use across all forms. Cloudflare does not allow for mixing and matching widgets / modes.

This integrations supports all three widget modes:

  • Managed
  • Non-interactive
  • Invisible

The differences are explained in your Turnstile account page. More detailed information on each can be found here.

4. Get your Cloudflare Turnstile Site and Secret keys

Once you select your widget mode, you will be able to access your Site Key and Secret Keys on the same page in your Cloudflare account. These need to be saved into Ninja Forms. Copy and paste them into Ninja Forms > Settings > Cloudflare Turnstile.

Be sure to Save Settings at the bottom of this page!

[Optional] 5. Choose how the widget will display on your forms

This step is only relevant if you selected Managed or Non-interactive widget mode.

By default, the widget will display on the form using Cloudflare’s standard styling and size. These can be adjusted globally for all forms under Ninja Forms > Settings. You also have the option to adjust them per form as you add a widget to a given form.

Add a Cloudflare Turnstile widget to your form(s)

Open any form and select Add New Field to open the fields window. Click the Cloudflare Turnstile field under Miscellaneous Fields to add it to your form. Drag and drop it to appear anywhere in the form you choose.

Turnstile field in the add new field window and added to the form beneath the submit button

You can optionally click on the field to adjust the widget’s Display settings. By default, the widget will display on the form using Cloudflare’s standard styling and size.

Now Publish (save) your form and Preview or refresh the page it lives on the see the Cloudflare Turnstile widget on your form (unless you selected Invisible widget mode, in which case it will be …[drumroll]… invisible 😉 ).

turnstile widget displayed on front end form beneath submit button

Repeat this for each form you need Turnstile on, and you’re done!