Atenção!

Este artigo contém código PHP e destina-se a desenvolvedores. Oferecemos este código como uma cortesia, mas não fornecemos suporte para personalizações de código ou desenvolvimento de terceiros.

Para orientação extra, consulte o tutorial do WPBeginner sobre como adicionar código personalizado.

Dispensar

Descrição

The wpforms_frontend_recaptcha_url filter used to alter the default URL for the reCAPTCHA language. By default, Google’s reCAPTCHA will detect the language and supply the correct translations for your site. This filter should only be used if you want to force the language for all visitors.

Parâmetros

$url
(string) URL used for the default language used in Google’s reCAPTCHA.

Fonte

wpforms/src/Frontend/Captcha.php

Mais Informações

The filter can be used to alter the default URL for the language on Google’s reCAPTCHA.

Exemplo

/**
 * Alter default reCAPTCHA language URL.
 *
 * @link    https://wpforms.com/developers/wpforms_frontend_recaptcha_url/
 *
 * @param   string  $url  URL of language to be used for Google's reCAPTCHA.
 * @return  string
 */

function wpf_dev_recaptcha_language( $url ) {
 
    // Set the language code to FR (French)
    return esc_url_raw( add_query_arg( array( 'hl' => 'fr '), $url ) );
}
 
add_filter( 'wpforms_frontend_recaptcha_url', 'wpf_dev_recaptcha_language', 10, 1);

Artigos de Referência

Como definir o idioma para o Google reCAPTCHA