Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Sun Mon Tue Wed Thu Fri Sat
9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 - -
- - - - - - -

Supporter timezone: Asia/Yerevan (GMT+04:00)

Tagged: 

This topic contains 19 replies, has 3 voices.

Last updated by Nigel 1 year, 1 month ago.

Assisted by: Christopher Amirian.

Author Posts
April 12, 2024 at 2:29 pm #15513233

jamesF-7

Hello, I followed this example article: https://wpml.org/documentation/getting-started-guide/language-setup/language-switcher-options/preserve-url-arguments-when-switching-languages/

However, it is not working. I am trying to preserve the 'code' param.

April 14, 2024 at 11:32 am #15515609

Christopher Amirian
WPML Supporter since 07/2020

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,

You are using a very old version of WPML and that might be contributing factor.

- IMPORTANT STEP! Create a backup of your website. Or better approach will be to test this on a copy/staging version of the website to avoid any disruption of a live website.
- Go to "WordPress Dashboard > Plugins > Add new > Commercial (tab)".
- Click the "Check for Updates" button.
- Update WPML and its addons there.

For more information:
https://wpml.org/faq/install-wpml/#automated-updates

Thanks.

April 15, 2024 at 6:11 pm #15521547

jamesF-7

Hello,

I updated all of the WPML plugins, and the issue persists.

April 17, 2024 at 1:35 pm #15532547

Christopher Amirian
WPML Supporter since 07/2020

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,

Thank you. Would you get back to us with the login information of your site so we can test, also please tell us which page and query parameter to check.

make sure you mark the next reply as private.

April 20, 2024 at 2:29 pm #15546180

Christopher Amirian
WPML Supporter since 07/2020

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,

Thank you I see the issue. I wonder if we have permission to copy your website to our server to be able to see if the issue is happening there or not and be able to report this to the second tier support?

April 23, 2024 at 6:19 pm #15557819

jamesF-7

Yes, please copy.

April 24, 2024 at 2:14 pm #15561139

Christopher Amirian
WPML Supporter since 07/2020

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,

Thank you very much. Unfortunately, the system asks for DFA Code which I do not have access too.

Would you please deactivate that additional security step so I can access?

Thanks.

April 24, 2024 at 3:13 pm #15561497

jamesF-7

Hi, I have removed DFA.

April 29, 2024 at 2:57 pm #15577892

jamesF-7

OK, I will likely have to manually provide an export due to this environment. I will follow up when we have it.

April 30, 2024 at 3:34 pm #15582037

jamesF-7

Hello, I have an export of the site prepared. It's a zip of all files. How can I best get this to you?

May 1, 2024 at 8:18 am #15583366

Christopher Amirian
WPML Supporter since 07/2020

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,

The best way is to use a third part service such as wetransfer to upload the file.

You can use the method below if the file size is not too big:

https://wpml.org/faq/provide-supporters-copy-site/

Also give us the instruction on how to use the ZIP file to install the website.

Thanks.

May 5, 2024 at 2:50 pm #15594399

Christopher Amirian
WPML Supporter since 07/2020

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,

Thank you very much, the issue os reported to the second tier support and I will get back to you as soon as I have an update.

Thank you.

May 7, 2024 at 10:26 am #15601141

Christopher Amirian
WPML Supporter since 07/2020

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,

Our awesome second tier support has an update. There are two options that you can use:

Option 1

They should set the page to Translatable only and it should work after pages are translated.

Option 2

Edit wp-content\plugins\sitepress-multilingual-cms\sitepress.class.php, go to line 2942 and replace

					} else {
						$translated_url = $display_as_translated_ls_link->get_url( $translations, $lang['code'] );
						if ( $translated_url ) {
							$lang['translated_url'] = $translated_url;
						} else {
							if ( $icl_lso_link_empty ) {
								if ( ! empty( $link_empty_to ) ) {
									$lang['translated_url'] = str_replace( '{%lang}', $lang['code'], $link_empty_to );
								} else {
									$lang['translated_url'] = $this->language_url( $lang['code'], true );
								}
							} else {
								$skip_lang = true;
							}
						}
						$lang['missing'] = 1;
					}

With:

					} else {
						$translated_url = $display_as_translated_ls_link->get_url( $translations, $lang['code'] );
						if ( $translated_url ) {
							$lang['translated_url'] = $translated_url;
							$lang['missing'] = 0;
						} else {
							if ( $icl_lso_link_empty ) {
								if ( ! empty( $link_empty_to ) ) {
									$lang['translated_url'] = str_replace( '{%lang}', $lang['code'], $link_empty_to );
								} else {
									$lang['translated_url'] = $this->language_url( $lang['code'], true );
								}
							} else {
								$skip_lang = true;
							}
							$lang['missing'] = 1;
						}
					}

Please get back to us with the result.

Thanks.

May 7, 2024 at 6:30 pm #15603567

jamesF-7

Thanks! I'd like to avoid modifying the core files. Is there a filter or action we could use?

If not, please outline the steps needed to be taken for solution #1

May 8, 2024 at 12:41 pm #15606166

Christopher Amirian
WPML Supporter since 07/2020

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,

I asked and will get back to you.

Meanwhile, the core change is a workaround that you can use.

We already reported this to the development team and it will be checked but a working solution might take a while.

So for now the code file change should be the best option.

The topic ‘[Closed] Query params not being preserved’ is closed to new replies.