TranslatePress renders individual language selector for default language incorrectly

Problem: When creating a customised language selector for TranslatePress: $arr = trp_custom_language_switcher(); $arr returns a multidimensional array with all the necessary parameters to render a customised language selector within a loop. In the frontend, however, when activating the foreign language, the entry of the array with the key "current_page_url" => "https://example.test/" was overwritten with https://example.com/en/ solution: In...

Michael Mai, 03.10.2022

Picture of a beautifully tidy garden

Problem:

When individually creating a language selector for TranslatePress:

$arr = trp_custom_language_switcher();

$arr returns a multi-dimensional array with all the necessary parameters to render an individual language selector within a loop.

In the frontend, however, when the foreign language was activated, the entry of the array was deleted with the key

"current_page_url" => "https://example.test/"

overwritten with

https://example.com/en/

Solution:

In this case, the option "Force language in individual links" was switched on in Options under (Settings > Translatepress > General). After deactivation ("No" option), the field content is rendered correctly.

See also

No contributions found