Helpers Functions
All Weglot functions you can call in WordPress to get informations
Weglot plugin is exposing functions that can be called in your code.
To see the source code of all available functions, you can go to the file : weglot-functions.php.
Make sure your plugin's version is > 3.0

weglot_get_service

1
weglot_get_service( string $service )
Copied!
Return a Weglot service.

weglot_get_options

1
weglot_get_options()
Copied!
Return all Weglot options.

weglot_get_option

1
weglot_get_option( string $key )
Copied!
Return Weglot option by key.

weglot_get_original_language

1
weglot_get_original_language()
Copied!
Return the original language key (string of 2 characters).

weglot_get_current_language

1
weglot_get_current_language()
Copied!
Return the current language key (2-le).

weglot_get_destination_languages

1
weglot_get_destination_languages()
Copied!
Return an array of public destination language keys.

weglot_get_request_url_service

1
weglot_get_request_url_service()
Copied!
Return weglot request URL service.

weglot_get_languages_available

1
weglot_get_languages_available()
Copied!
Return an array of all languages objects available.

weglot_get_button_selector_html

1
weglot_get_button_selector_html( string $add_class = '' )
Copied!
Return the language's selector button HTML in string format.

weglot_get_exclude_urls

1
weglot_get_exclude_urls()
Copied!
Return an array of all excluded URLs.

weglot_get_translate_amp_translation

1
weglot_get_translate_amp_translation()
Copied!
Return true if amp pages translation is activated.

weglot_get_current_full_url

1
weglot_get_current_full_url()
Copied!
Return a string of current URL.

weglot_is_eligible_url

1
weglot_is_eligible_url( string $url )
Copied!
Return true if $url is an eligible URL.

weglot_get_api_key

1
weglot_get_api_key()
Copied!
Return a string of private API key.

weglot_has_auto_redirect

1
weglot_has_auto_redirect()
Copied!
Return true if redirect users based on their browser language option is activated.

weglot_get_full_url_no_language

1
weglot_get_full_url_no_language()
Copied!
Return a string of current URL without the language key

weglot_get_rest_current_url_path

1
weglot_get_rest_current_url_path()
Copied!
Return a string of rest current URL path.

Last modified 9mo ago