Setting recaptcha in a different language other than english

后端 未结 6 2284
南笙
南笙 2021-02-13 20:37

Is it me or is recaptcha images cannot be translated to another language other than EN? I have \"enter

6条回答
  •  北海茫月
    2021-02-13 20:40

    You just have to add this function above to your theme's function.php file and all done. It really works for me, you can change translation language by modifying country code in hl parameter.

    Here i'm using es here for Spanish translation.

    This is a list of language country codes: https://developers.google.com/recaptcha/docs/language

    function wptricks24_recaptcha_scripts() {
        wp_deregister_script( 'google-recaptcha' );
    
        $url = 'https://www.google.com/recaptcha/api.js';
        $url = add_query_arg( array(
            'onload' => 'recaptchaCallback',
            'render' => 'explicit',
            'hl' => 'es'), $url ); // es is the language code for Spanish language
    
        wp_register_script( 'google-recaptcha', $url, array(), '2.0', true );
    }
    
    add_action( 'wpcf7_enqueue_scripts', 'wptricks24_recaptcha_scripts', 11 );
    

提交回复
热议问题