Forum Replies Created

Viewing 5 replies - 46 through 50 (of 50 total)
  • Thread Starter Webzzz

    (@webzzz)

    Do you think this will work?

    
    function custom_recaptcha_enqueue_scripts() {
    
    		$current_lang = false;
    
    		// lang from a multilang plugin (if any used)
    		if(class_exists('WPGlobus')){
    			// WPGlobus found
    			$current_lang = WPGlobus::Config()->language;
    		} else if(defined('ICL_LANGUAGE_CODE')){
    			//Perhaps WPML??
    			$current_lang = ICL_LANGUAGE_CODE;
    		}
    
    		// provided recaptcha langs from google (as of March 24th, 2016)
    		$provided_langs = array('ar','af','am','hy','az','eu','bn','bg','ca','zh-HK','zh-CN','zh-TW','hr','cs','da','nl','en-GB','en','et','fil','fi','fr','fr-CA','gl','ka','de','de-AT','de-CH','el','gu','iw','hi','hu','is','id','it','ja','kn','ko','lo','lv','lt','ms','ml','mr','mn','no','fa','pl','pt','pt-BR','pt-PT','ro','ru','sr','si','sk','sl','es','es-419','sw','sv','ta','te','th','tr','uk','ur','vi','zu');
    
    		if(in_array($current_lang, $provided_langs)) {
    			// remove CF7 script call
    			wp_deregister_script( 'google-recaptcha' );
    
    			$url = 'https://www.google.com/recaptcha/api.js';
    			$url = add_query_arg( array(
    				'onload' => 'recaptchaCallback',
    				'render' => 'explicit',
    				'hl' => $current_lang ), $url );
    
    			// load recaptcha with language parameter
    			wp_register_script( 'google-recaptcha', $url, array(), '2.0', true );
    		}
    	}
    
    Thread Starter Webzzz

    (@webzzz)

    and is this plugin using contact-form-7?

    Thread Starter Webzzz

    (@webzzz)

    Thank you for your answer Igor, isn’t this solution will make it always same language? what if you have few languages? [we use wpml, and we have 3 languages]

    is it because of translation? if so I have similar problem it shows recaptcha only in English ??

    is there any way to change it?

    Thread Starter Webzzz

    (@webzzz)

    Strange now it’s not showing a toggle option anymore it says “Required”

    Ok I think the problem is with WPML one have to check each language and add a privacy policy or the error will show up again and there will be a toggle instead of required.

Viewing 5 replies - 46 through 50 (of 50 total)