I’m a big fan of Cloudflare Turnstile. Compared to Google reCAPTCHA’s clunky challenges and data-heavy approach, Turnstile delivers a sleek, privacy-first experience that doesn’t make users jump through hoops.
I wanted to add Turnstile protection to the excellent Quiz And Survey Master, because their out of the box captcha isn’t ideal… and I didn’t want their Google reCAPTCHA add-on.
So I wrote my own solution using Turnstile.
Table of Contents
Step 1: Setup Cloudflare Turnstile
You will first need to obtain a sitekey and a secret key from Cloudflare. The sitekey and secret key are always associated with one widget and cannot be reused for other widgets.
Log in to the Cloudflare dashboard ↗ and select your account.
Go to Turnstile.
Select Add widget and fill out the site name and website hostname
Select the widget mode.
Copy your sitekey and secret key.
Make sure you keep the secret key safe for security reasons.
Step 2: Install The Turnstile Plugin
The easiest way to add turnstile functionality to your WordPress site is to use the Simple Cloudflare Turnstile Plugin.
You simply install and activate the plugin, and add the Turnstile credentials created above.
The plugin author has an excellent tutorial on getting this all set up, including enabling it on your login, registration, comment and contact form!
Step 3: Add Turnstile To Your QSM Quizzes
You are ready to add turnstile to your Quiz And Survey Master quizzes.
To do this, simply add the following code to your WordPress theme functions.php
file:
Continue reading for 10,000 sats