Hooks
modal_kit_pro_captcha_hostnames
filter
Pro
PHP
Accept bot check tokens solved on other hostnames, such as a static copy of the site that still sends its forms to this one.
Runs each time the site checks a bot check token: on the form relay and when a game with the check on is played. The provider reports the hostname the visitor solved the check on, and the site refuses the token unless that hostname is in this list.
By default the list holds the hosts of the Site Address and the WordPress Address (home_url() and site_url()).
Parameters
Parameter
Description
$hosts
string[]
Hostnames, without a scheme or port.
Returns
string[] The hostnames, compared in lower case. An empty array switches the hostname check off.
Example
Allow a static copy of the site
WordPress runs at cms.example.com and visitors see a static export at www.example.com, whose forms still go through this site.
add_filter( 'modal_kit_pro_captcha_hostnames', function ( $hosts ) {
$hosts[] = 'www.example.com';
return array_unique( $hosts );
} );
Good to know
Most providers also keep a list of allowed domains for each site key. Add the hostname there too, or the widget may refuse to load on it.
Tokens checked with a provider’s published test secret skip the hostname check, because they’re solved on the provider’s own test host.
Applied in modal-kit-pro/includes/Captcha.php.
Related