TranslatePress renders individual language selector for default language incorrectly

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.