Setting Up Cloudflare Turnstile

Would you like to use Cloudflare Turnstile to prevent spam RSVP submissions in Sugar Calendar Events? Cloudflare Turnstile is a free, CAPTCHA-like alternative that offers a user-friendly experience by confirming visitors are real humans without showing them any puzzles.

This tutorial will show you how to set up and use Cloudflare Turnstile with Sugar Calendar Events.


Before you get started, ensure Sugar Calendar is installed and activated on your WordPress site and that you have the RSVP addon set up.

Generating Cloudflare Turnstile API Keys

To get started, you’ll need to create a Cloudflare account and generate API keys for your site.

Adding Your Site in Cloudflare

First, log in to your Cloudflare account. Once you’re logged in, navigate to the Turnstile menu from the sidebar and click on the Add widget button.

Click Add Widget Button

In the Widget setup page, enter a name for your widget in the Widget name field. This name is for internal use only to help you identify widgets on your Cloudflare account.

Enter Widget Name

Next, under Hostname Management, click the Add Hostnames button.

Click Add Hostnames Button

In the Add a custom hostname field, enter your site’s domain (for example, example.com) and click the Add button.

Add Custom Hostname

Once your hostname appears in the list, click the Add button at the bottom of the panel to confirm.

Confirm Hostname Addition

Next, you’ll need to configure the widget mode. We recommend keeping this set to Managed, which is the default option.

Select Widget Mode

Finally, click the Create button to generate your API keys.

Click Create Button

Once done, Cloudflare will generate your Site Key and Secret Key. Make note of these as you’ll need them to configure Sugar Calendar Events.

Cloudflare API Keys Generated

Configuring RSVP Spam Prevention

Now that you have your Cloudflare Turnstile API keys, it’s time to configure Sugar Calendar to use them.

In your WordPress admin area, go to Events » Settings and click on the RSVP tab.

Navigate to RSVP Settings Tab

Next, select the Turnstile option to enable Cloudflare Turnstile for your RSVP forms.

Select Turnstile Option

After selecting Turnstile, additional configuration options will appear. Enter your Cloudflare Turnstile Site Key and Secret Key in their respective fields.

Enter Turnstile API Keys

Configuring Additional Settings

Below the API keys, you can configure additional settings for the Cloudflare Turnstile widget:

Theme: Choose the visual appearance of the Turnstile widget. Options include:

  • Auto: This option automatically switches between Light and Dark mode based on user’s device settings
  • Light: Light theme
  • Dark: Dark theme

Configure Turnstile Theme

Fail Message: This option lets you customize the error message that appears when Turnstile verification fails. The default message is “Cloudflare Turnstile verification failed, please try again.”

No-Conflict Mode: Enable this option if Cloudflare Turnstile is being loaded multiple times on your site and causing conflicts. This will remove any other CAPTCHA occurrences to prevent conflicts.

After configuring all settings, click the Save Settings button to apply your changes.

Save Turnstile Settings

You should see a preview of the Cloudflare Turnstile widget if everything is configured properly.

Turnstile widget preview

Testing Cloudflare Turnstile

Once you’ve configured Cloudflare Turnstile, it’s important to test that it’s working properly on your RSVP forms.

To test the integration, visit an event on your site’s frontend that has RSVP enabled. When you attempt to submit an RSVP, you should see the Cloudflare Turnstile verification widget appear.

Cloudflare Turnstile Verification Widget

The widget will automatically verify that you’re a human visitor before allowing the RSVP submission to proceed.

Frequently Asked Questions

Below are answers to some of the most common questions about using Cloudflare Turnstile with Sugar Calendar Events.

What’s the difference between Turnstile and reCAPTCHA?

Cloudflare Turnstile provides a more user-friendly experience compared to traditional reCAPTCHA. While reCAPTCHA often requires users to solve puzzles or identify images, Turnstile typically verifies users automatically without requiring any interaction, making it less intrusive for your visitors.

Can I use Turnstile on multiple websites?

Yes, you can add multiple hostnames to your Cloudflare Turnstile widget configuration. This allows you to use the same Site Key and Secret Key across multiple websites.

Is Cloudflare Turnstile free to use?

Yes, Cloudflare Turnstile is completely free to use for protecting your forms from spam submissions.

What happens if Turnstile verification fails?

If a visitor fails the Turnstile verification process, they’ll see the custom fail message you configured, and their RSVP submission will not be processed. They’ll need to try submitting again to complete the verification.

That’s it! You’ve successfully set up Cloudflare Turnstile to protect your Sugar Calendar RSVP forms from spam submissions.

Next, would you like to learn how to display events on your site’s frontend? Check out our tutorial on displaying event lists to learn how.