• Resolved Wondercrow

    (@wondercrow)


    I would like the recaptcha to use the language of the site (not the browser).

    I got this code working with Captcha on WPC Form 7, but not with this plugin.

    add_action( ‘wpcf7_enqueue_scripts’, ‘custom_recaptcha_enqueue_scripts’, 11 );

    function custom_recaptcha_enqueue_scripts() {
    $current_lang = ICL_LANGUAGE_CODE;
    wp_deregister_script( ‘elementor-recaptcha-api’ );

    $url = ‘https://www.google.com/recaptcha/api.js’;
    $url = add_query_arg( array(
    ‘onload’ => ‘recaptchaCallback’,
    ‘render’ => ‘explicit’,
    ‘hl’ => $current_lang ), $url );

    wp_register_script( ‘elementor-recaptcha-api’, $url, array(), ‘2.0’, true );
    }

    I guess I need to know what the wpcf7_enqueue_scripts in add_action( ‘wpcf7_enqueue_scripts’, ‘custom_recaptcha_enqueue_scripts’, 11 ) by the correct target. Could you please help me? Thanks a lot!

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • You can add following code in your theme’s (child theme’s if you are using) functions.php

    add_filter( 'anr_get_option', function( $value, $option ){
    	if ( 'language' === $option ) {
    		$value = ICL_LANGUAGE_CODE;
    	}
    	return $value;
    }, 10, 2);
    
    Thread Starter Wondercrow

    (@wondercrow)

    Works perfectly. Thanks a lot for your fast answer!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘ReCaptcha v2 multilingual issue’ is closed to new replies.