/', '', $turnstile_field);
$turnstile_field = preg_replace('/
]*>)/';
if (preg_match($pattern, $block_content)) {
return preg_replace($pattern, $turnstile_field . '$1', $block_content, 1);
}
// Fallback: inject before the closing form tag.
$pos = strripos($block_content, '');
if ($pos !== false) {
return substr_replace($block_content, $turnstile_field, $pos, 0);
}
return $block_content;
}
// Kadence Blocks PRO Contact Form Submission Check
add_action('kadence_blocks_form_verify_nonce', 'cfturnstile_kadence_check', 10, 1);
function cfturnstile_kadence_check($nonce) {
if (cfturnstile_whitelisted()) {
return $nonce;
}
$check = cfturnstile_check();
$success = $check['success'];
if ($success != true) {
wp_die(cfturnstile_failed_message());
}
return $nonce;
}
}