Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

weglot_default_current_language_empty

When we not able to find the current language, we set it to the original language by default. This filter allow you to modifiy.

Runs when Weglot cannot read the current language from the URL, for example during a WP-CLI command. The filter receives the original language (a Weglot\Client\Api\LanguageEntry) and must return a LanguageEntry.

add_filter( 'weglot_default_current_language_empty', 'custom_weglot_default_current_language' );
function custom_weglot_default_current_language( $language ) {
    // Use French instead of the original language.
    return weglot_get_service( 'Language_Service_Weglot' )->get_language_from_internal( 'fr' );
}

Last updated