Skip to content

Instantly share code, notes, and snippets.

@shivapoudel
Last active July 21, 2020 07:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shivapoudel/75e6d6167af25ee61d46fc27534609ab to your computer and use it in GitHub Desktop.
Save shivapoudel/75e6d6167af25ee61d46fc27534609ab to your computer and use it in GitHub Desktop.
Everest Forms - Support reCAPTCHA v2 Language code. (Updated for 1.7.0)
<?php // Do not include this if already open!
/**
* Code goes in theme functions.php.
*/
add_filter( 'everest_forms_frontend_recaptcha_url', 'evf_recaptcha_lang_code', 10, 2 );
/**
* Language code support for reCAPTCHA v2.
*
* @param string $recaptcha_url reCAPTCHA Url.
* @param string $recaptcha_type reCAPTCHA type.
*
* @return string Modified url with language code.
*/
function evf_recaptcha_lang_code( $recaptcha_url, $recaptcha_type ) {
if ( 'v2' === $recaptcha_type ) {
/**
* Forces the widget to render in a specific language.
* Additionally, uuto-detects the user's language if unspecified.
*
* @see https://developers.google.com/recaptcha/docs/display#config
*/
$recaptcha_url = add_query_arg( 'hl', 'id', $recaptcha_url );
}
return $recaptcha_url;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment