hCaptcha integration
Marc Wagner
March 11, 2025
The Forge12 Double-Opt-In Plugin(Avada | Elementor | CF7) Plugin makes it possible to integrate external captcha tools using the built-in hooks.
WordPress Captcha Plugin from Forge12
We offer a captcha plugin that effectively protects against bots and spam. This is available free of charge in the WordPress plugin store and is compatible with the double opt-in plugin.
Integration of hCaptcha #
To use the double opt-in plugin with hCaptcha, you must integrate the following code. We recommend the WP Code plugin for this. Alternatively, you can easily insert the code in your functions.php
.
add_action('f12_cf7_doubleoptin_before_send_default_mail', 'disable_hcaptcha'); /** * Disables the hCaptcha verification by removing the related filter from the specified WordPress filter hook. * * This function searches for a specific callback function in the predefined WordPress filter and * removes it if found, effectively disabling the hCaptcha verification process. * * @return void * @global array $wp_filter The global WordPress filters array. */ function disable_hcaptcha() { global $wp_filter; $tag = 'wpcf7_validate'; $function_to_remove = 'verify_hcaptcha'; if (isset($wp_filter[$tag])) { foreach($wp_filter[$tag]->callbacks as $priority => $hook){ foreach($hook as $function_name => $callbacks){ if(str_contains($function_name, $function_to_remove)){ foreach($callbacks as $callback){ $wp_filter[$tag]->remove_filter($tag, $callback, $priority); } } } } } }
The code temporarily removes the hCaptcha validation when the opt-in is confirmed, allowing the opt-in mail to be sent.

Article from:
Marc Wagner
Hi Marc here. I’m the founder of Forge12 Interactive and have been passionate about building websites, online stores, applications and SaaS solutions for businesses for over 20 years. Before founding the company, I already worked in publicly listed companies and acquired all kinds of knowledge. Now I want to pass this knowledge on to my customers.