StartTechnical documentation / snippetsProblem and solutionTranslatePress renders individual language selector for default language incorrectly

TranslatePress renders individual language selector for default language incorrectly

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.

Posted in

We will be happy to call you back.

Scroll to Top