• Resolved André Schröder

    (@purevelvetdesign)


    Hello.

    Can you help me to disable hcaptcha for specific form/page.
    Using Contact Form 7.

    Thank you.

    Best regards
    André

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor kaggdesign

    (@kaggdesign)

    The ability to skip hCaptcha verification on the specific form was added for CF7 in v2.9.0, which will be published in days.

    Here is the instruction on how to do it.

    Thread Starter André Schröder

    (@purevelvetdesign)

    Hi, thanks for response!
    Yes I found this too but don’t got it to work.

    How the link should looking like and is the ID of the CF7 right there?
    contact-form-7/wp-contact-form-7.php

    Best regards
    André

    Plugin Contributor kaggdesign

    (@kaggdesign)

    Here is the working example how to skip hCaptcha verification for CF7 form with id = 177.

    /**
     * Filters the protection status of a form.
     *
     * @param string     $value   The protection status of a form.
     * @param string[]   $source  The source of the form (plugin, theme, WordPress Core).
     * @param int|string $form_id Form id.
     *
     * @return bool
     */
    function hcap_protect_form_filter( $value, $source, $form_id ) {
    	if ( ! in_array( 'contact-form-7/wp-contact-form-7.php', $source, true ) ) {
    		// The form is not sourced by CF7 plugin.
    		return $value;
    	}
    
    	if ( 177 !== (int) $form_id ) {
    		// The form has id !== 177.
    		return $value;
    	}
    
    	// Turn off protection for form with id = 177.
    	return false;
    }
    
    add_filter( 'hcap_protect_form', 'hcap_protect_form_filter', 10, 3 );
    
    Thread Starter André Schröder

    (@purevelvetdesign)

    Thank you. I inserted this code tu Child Themes functions.php but it doesn’t work. ID of the form is 6578.

    /**

    • Filters the protection status of a form.
      *
    • @param string $value The protection status of a form.
    • @param string[] $source The source of the form (plugin, theme, WordPress Core).
    • @param int|string $form_id Form id.
      *
    • @return bool
      */
      function hcap_protect_form_filter( $value, $source, $form_id ) {
      if ( ! in_array( ‘contact-form-7/wp-contact-form-7.php’, $source, true ) ) {
      // The form is not sourced by CF7 plugin.
      return $value;
      } if ( 6578 !== (int) $form_id ) {
      // The form has id !== 6578.
      return $value;
      } // Turn off protection for form with id = 6578.
      return false;
      }

    add_filter( ‘hcap_protect_form’, ‘hcap_protect_form_filter’, 10, 3 );

    Best regards

    Plugin Contributor kaggdesign

    (@kaggdesign)

    As I mentioned above, it is still not released. v2.9.0 will be released in several days.

    Today, you can get and build v2.9.0 from GitHub only, using appropriate branch.

    Thread Starter André Schröder

    (@purevelvetdesign)

    Ah okay, thank you very much! Not it works.

    Best regards
    André

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Disable for specific CF7’ is closed to new replies.