WPML

Some plugins use URL arguments, and you may want to keep them when switching languages. Here’s how you can do that using WPML’s language switcher options.

You can preserve these URL arguments by going to WPMLSettingsLanguage Switchers and filling in the Preserve URL arguments field in the Language switcher options card. The arguments you want to preserve should be added as a comma-separated list.

The Preserve URL arguments field in Language switcher options
The Preserve URL arguments field in Language switcher options

Let’s consider the following example of using this feature. Suppose you add the following arguments: bar, foo.

You translate the “Hello world” post. In the front-end, open the “Hello world” post and add this at the end of the URL: ?bar=10&foo=100&lost=1000 (notice that we added the two arguments + the lost one).When you switch the language, the URL will end only with ?bar=10&foo=100.

Written by Amir · Last updated March 1, 2023