Add Cloudflare Turnstile to WordPress Comments in Bricks Theme

Bricks Builder has Cloudflare Turnstile integration built in allowing you to add your Turnstile site and secret keys to the API tab in Bricks Settings. This then allows you to add Turnstile to custom login pages and native Bricks form elements.

However it currently does not allow for usage of Turnstile in WordPress comments, here is how to fix that.

First in your Comments element, set the source to WordPress.

Bricks Comments Turnstile

Then add the code in your functions.php file and remove the opening php brace.

Things to change in the code:

  • Add your Turnstile Keys
  • Decide whether to run the Challenge Turnstile script conditionally

The Turnstile challenge will only run to logged out users.

Ref 

Cloudflare Turnstile Bricks Theme

Leave the first comment