ElliotSowersby / simple-cloudflare-turnstile

WordPress Plugin: Easily add Cloudflare Turnstile to all your WordPress website forms to protect them from spam!
38 stars 12 forks source link

can spam goes through if spammers make _wpcf7 == "" <- means post empty value for this? #18

Open ouvaa opened 6 months ago

ouvaa commented 6 months ago

can spam goes through if spammers make _wpcf7 == "" <- means post empty value for this?

// Validate form submission
add_filter('wpcf7_validate', 'cfturnstile_cf7_verify_recaptcha', 20, 2);
function cfturnstile_cf7_verify_recaptcha($result) {

        if (!class_exists('WPCF7_Submission')) {
                return $result;
        }

        $post = WPCF7_Submission::get_instance();

        $_wpcf7 = !empty($_POST['_wpcf7']) ? absint($_POST['_wpcf7']) : 0;

        if (!empty($post)) {