Skip validation

Marc Wag­ner

March 11, 2025

1 min read|

With the fil­ters inte­gra­ted in the plug­in, it is pos­si­ble to skip the vali­da­ti­on for indi­vi­du­al forms.

Filter #

It is pos­si­ble to skip the vali­da­ti­on for cer­tain forms. You can use the fil­ter f12-cf7-captcha-skip-vali­­da­­ti­on for this.

add_filter('f12-cf7-captcha-skip-validation', function($skip){
    // Wenn bereits ein Überspringen der Validierung angefordert wurde, direkt diesen Wert zurückgeben.
	if($skip){
      return $skip;
    }
  
    // Für alle anderen Formulare soll die Captcha-Validierung nicht übersprungen werden.
    return false;
});

Eit­her true or fal­se is expec­ted as the return value. If the vali­da­ti­on is to be skip­ped, true is retur­ned.

Example Contact Form 7 #

To skip the vali­da­ti­on for the Cont­act Form 7 form with the Post ID 1234, you can use the fol­lo­wing code:

add_filter('f12-cf7-captcha-skip-validation', function($skip) {
    // Wenn bereits ein Überspringen der Validierung angefordert wurde, direkt diesen Wert zurückgeben.
    if ($skip) {
        return $skip;
    }

    // Prüfen, ob das abgesendete Formular die ID 1234 hat.
    // Ist das der Fall, wird die Captcha-Validierung für dieses spezielle Formular übersprungen.
    if (isset($_POST['_wpcf7']) && (int)$_POST['_wpcf7'] === 1234) {
        return true;
    }

    // Für alle anderen Formulare soll die Captcha-Validierung nicht übersprungen werden.
    return false;
});
88e86fcb816eff22bc917094df2862d8dd5c0e978b333e6dd5f36f808990c261 96

Artic­le from:

Marc Wag­ner

Hi Marc here. I’m the foun­der of Forge12 Inter­ac­ti­ve and have been pas­sio­na­te about buil­ding web­sites, online stores, appli­ca­ti­ons and SaaS solu­ti­ons for busi­nesses for over 20 years. Befo­re foun­ding the com­pa­ny, I alre­a­dy work­ed in publicly lis­ted com­pa­nies and acqui­red all kinds of know­ledge. Now I want to pass this know­ledge on to my cus­to­mers.

Do you have a ques­ti­on? Plea­se lea­ve a com­ment