Turnstile for HivePress [Custom Plugin]

Hey @everyone,

I’ve been looking into Google reCAPTCHA alternatives to fight bots and noticed Cloudflare Turnstile is highly recommended. I found this great plugin to implement it:

Out of the box, it didn’t support HivePress forms. I requested support from the plugin author, but in the meantime, I’ve been playing around with AI and managed to build a working solution myself!

If you want to use Turnstile with HivePress, feel free to grab my bridge plugin here:

:gear: How to use it:

  1. This acts as a bridge, so you will need both the original Simple Cloudflare Turnstile plugin and HivePress installed.
  2. Once activated, it will seamlessly add HivePress form options directly to the WP > Settings > Cloudflare Turnstile page.
  3. You’ll just need to grab your free Turnstile API keys from your Cloudflare Dashboard.

I’ve shared the code with the original plugin developer to help speed up official integration down the road, but this bridge is working perfectly for me in the meantime. Let me know if it works for you! :slightly_smiling_face:

Cheers,
Chris :victory_hand:

PS: if you find my posts like this useful, please consider giving a small donation to help me to continue contributing to the community! :smiling_face:

2 Likes

Thanks for sharing, really appreciate this! We’ll also consider adding integration with Turnstile to the HivePress core.

2 Likes

Hey @everyone :wave:

Big update on Turnstile for HivePress. The plugin from my original post has
been completely rewritten since v1, and after a full testing pass on a
live staging site with real challenge solves, I’m happy to call the new build
stable! :tada:

:backhand_index_pointing_right: Download it here! - (always the latest version, and you’ll now get any future updates in your WP dashboard):

What’s new since v1

:closed_lock_with_key: Proper HivePress integration. The plugin now uses
HivePress’s own native captcha field system (the same three form filters core
uses for reCAPTCHA), so the widget is a genuine form field rather than injected
HTML. That means it works everywhere HivePress renders a form, including the
login, register and reset password modal pop-ups, with no blank widgets when you
switch between them.

:white_check_mark: One simple “Protected Forms” list. Open Settings >
Cloudflare Turnstile, expand the HivePress section and tick the forms you want
protected. The list is discovered from HivePress itself, so it automatically
includes captcha-ready forms from any extension you run: Login, Register,
Reset Password, Submit Listing and Report Listing from core, plus Confirm
Booking (Bookings), Claim Listing (Claim Listings), Dispute Order
(Marketplace), Send Message (Messages), Submit Request and Submit Offer
(Requests), and Write a Review / Reply to Review (Reviews).

:gear: All your Simple Cloudflare Turnstile settings apply automatically.
Keys, theme, size, language, appearance, failure message, whitelist rules and
the Cloudflare-down failsafe. Nothing to configure twice.

:arrows_counterclockwise: Automatic updates. The plugin now updates itself
from GitHub through the normal WordPress Plugins screen: update notices, a
“View details” changelog and one-click updates, plus a “Check for updates”
link on the plugin row.

:iphone: Small-screen fix. Cloudflare draws its widget at a fixed width,
which could overflow narrow popups on small phones. The widget now scales to
fit, so it sits neatly inside the modal on any screen size.

:test_tube: Tested properly before this post. Every protectable form from
the official extensions, all six official themes, WordPress 7.0, caching and
JS-optimisation plugins (Autoptimize and SiteGround Speed Optimizer), and a
full staging pass over HTTPS, including the wrong-password retry case that
used to trip captcha plugins up.

Requirements and installing

New users: install and activate both plugins above, then this one. Enter
your keys under Settings > Cloudflare Turnstile, open the HivePress section at
the bottom of that page, tick the forms you want and save.

If you installed version 1 from this thread: update once by hand. Go to
Plugins > Add New > Upload Plugin, choose the zip from the link above and pick
“Replace current with uploaded” when WordPress offers it. Then open the
settings and tick your forms again (the selection format changed in the
rewrite). From this version on, updates arrive on your Plugins screen like any
other plugin.

A few things worth knowing

  • If you also have HivePress’s built-in reCAPTCHA keys configured, protected
    forms will show BOTH captchas and require both to pass. If you are switching
    to Turnstile, remove the reCAPTCHA keys from HivePress settings first. The
    plugin shows a warning if it spots this.
  • If a caching or JS-optimisation plugin ever stops the widget appearing, add
    challenges.cloudflare.com and turnstile-render.js to its “exclude from
    delay/defer JavaScript” list. In my testing the popular ones needed no
    exclusions at all.
  • If Cloudflare itself has an outage, the plugin follows the Simple Cloudflare
    Turnstile failsafe setting, so your forms behave exactly like the rest of
    your site.

If you hit a problem, reply here with your theme and the form involved and
I’ll take a look. @kseniia - the original topic was closed, so if you wouldn’t mind merging this - and, if you could update the link in the OP, that would be amazing! :face_blowing_a_kiss:

Cheers,
Chris :v:

P.S. The plugin is free and always will be. If it saves your site from the
bots and you fancy keeping the community tools coming, you can buy me a coffee here :hot_beverage:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

Hi Chris,

Thanks a lot for taking the time to contribute to the HivePress ecosystem!

I hope your work inspires other community members to share their own solutions as well. It’s great to see how HivePress’s flexibility and extensibility can be used to create custom products and expand the ecosystem.

I’ve merged the topics and updated the link accordingly.

Thanks again for your contribution! :face_holding_back_tears:

1 Like