AI Summary
Description
The wpforms_frontend_captcha_api
filter lets you change the URL used to load the CAPTCHA script on the frontend. This is commonly used to swap the default Google reCAPTCHA URL with an alternate domain.
Use this filter to point reCAPTCHA to a different host if the default domain is blocked in your region or you prefer Google’s alternate domain recommendation.
parameter | type | description |
---|---|---|
$captcha_api | string | The CAPTCHA API URL that WPForms will enqueue. Return a different URL to override it. |
Source
wpforms\src\Frontend\Captcha.php
Example
/**
* Load reCAPTCHA from the alternate domain.
*/
function wpf_dev_change_recaptcha_url( $captcha_api ) {
return str_replace(
'https://www.google.com/recaptcha/api.js',
'https://www.recaptcha.net/recaptcha/api.js',
$captcha_api
);
}
add_filter( 'wpforms_frontend_captcha_api', 'wpf_dev_change_recaptcha_url' );