• Resolved bitsisc

    (@bitsisc)


    Hi
    Today I found out that the contact forms using recaptcha v2 in contact form 7, in any site that I have installed it, are not visible!
    As you can see in the pagecode here the code is there

    div class="grecaptcha-noscript">
    		<iframe src="https://www.google.com/recaptcha/api/fallback?k=6LcVG_kgAAAAAPyMK7Tqyf_hbwtaHhMcvAw8EfQk" frameborder="0" scrolling="no" width="310" height="430">
    		</iframe>
    		<textarea name="g-recaptcha-response" rows="3" cols="40" placeholder="reCaptcha Response Here">
    		</textarea>
    	</div>

    but nothing ….
    Thanks in advance,
    Christos

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter bitsisc

    (@bitsisc)

    Please ignore my message, it was a conflict with a function I had added to functions.php in order to enable language choice for recaptcha:

    remove_action( 'wpcf7_enqueue_scripts', 'wpcf7_recaptcha_enqueue_scripts' );
    add_action( 'wpcf7_enqueue_scripts', 'wpcf7_recaptcha_enqueue_scripts_custom' );
     
    function wpcf7_recaptcha_enqueue_scripts_custom() {
        $hl = 'en';
        if (ICL_LANGUAGE_CODE == 'el') $hl = 'el';
        if (ICL_LANGUAGE_CODE == 'sr') $hl = 'sr';
        if (ICL_LANGUAGE_CODE == 'ro') $hl = 'ro';
         
        $url = 'https://www.google.com/recaptcha/api.js';
        $url = add_query_arg( array(
            'hl' => $hl,
            'onload' => 'recaptchaCallback',
            'render' => 'explicit' ), $url );
     
        wp_register_script( 'google-recaptcha', $url, array(), '2.0', true );
    }
    
    Plugin Author IQComputing

    (@iqcomputing)

    Hello @bitsisc

    We’re glad you were able to fix your issue. By default, the language should use the site selected language but we also have a filter hook if this helps:

    'hl' => esc_attr( apply_filters( 'wpcf7_recaptcha_locale', get_locale() ) )

    Which you may be able to use like this:

    /**
     * Change reCaptcha Locale as needed
     *
     * @param String $locale	- The value of get_locale()
     *
     * @return String $locale
     */
    function wpf15832519_recaptcha_locale( $locale ) {
    	
    	if( defined( 'ICL_LANGUAGE_CODE' ) ) {
    		$locale = ICL_LANGUAGE_CODE;
    	}
    	
    	return $locale;
    	
    }
    add_filter( 'wpcf7_recaptcha_locale', 'wpf15832519_recaptcha_locale' );
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Recaptchs is not visible in contact form’ is closed to new replies.