Home›Support›English Support›[Resolved] Under certain conditions, alternate language URL links to current language
[Resolved] Under certain conditions, alternate language URL links to current language
This thread is resolved. Here is a description of the problem and solution.
Problem: If you're experiencing issues where the language selector does not change the language on blog posts, and instead links to the current language rather than the selected alternate language, the issue might be with your theme's functions.php file. Solution: In this case, the issue was caused by a function inside the functions.php file of a Child Theme:
This code modifies the blog post links and can interfere with the WPML language switcher. Removing this snippet should allow the language switcher to function correctly.
If this solution does not resolve your issue, or if it seems outdated or irrelevant to your case, we highly recommend checking related known issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. Additionally, you can open a new support ticket for further assistance at WPML support forum.
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.
Background of the issue:
I am trying to resolve an issue where, under certain conditions, links to alternate languages link to the current language instead of the selected alternate language. The language selector works under most conditions on the site but not when viewing blog posts. Examples of the issue can be seen at: hidden link and hidden link. I have disabled all plugins except WPML, and the issue persists. We are using the `wpml_language_selector_widget` shortcode, but the behavior occurs regardless of how we present the language change UI.
Symptoms:
When viewing blog posts, selecting a different language in the language selector does not change the language of the page. For example, if viewing in Spanish, selecting English does not switch to the English page, and vice versa.
Questions:
Why does the language selector not change the language on blog posts?
Is there a known issue with WPML affecting language switching on blog posts?
Did this ticket submission form just rewrite everything I spent a while writing up? Or is the original text stored somewhere, and this is just a quick summary for support to glance at?
Could you please increase the WordPress memory limit (WP Memory Limit) to at least 256 MB? WPML requires at least 128M.
Your current values are:
PHP Memory Limit 512M
WP Memory Limit 40M
You need to connect to your website's server and open the wp-config.php file in a text editor. The file is located in the WordPress root directory.
Add this code to the wp-config.php file to increase WordPress memory:
define ('WP_MEMORY_LIMIT', '256M');
Add this just before this comment:
// That's all, stop editing! Happy blogging.
The current values can be viewed under WPML > Support > WordPress.
These settings can be restricted directly by your hosting provider. Therefore, I recommend contacting them and asking them to change them directly if the changes are not applied immediately.
Now, please verify if the issue persists. In doubt, make sure to update the original post and apply the translation again.
If this will not solve the issue, please let me know.
This was updated to 128M during the initial support submission (as part of the process it asks about this), but it didn't help, so it was returned to it's default.
That said, I just updated it to 256M as per your request, and the issue persists.
Languages: English (English )Spanish (Español )German (Deutsch )
Timezone: America/Lima (GMT-05:00)
Hi,
I would like to offer to take a closer look and request temporary access (wp-admin and FTP) to the site to investigate the issue further.
The required fields are below the comment section when you log in to leave the next reply. The information you provide is private, meaning only you and I can see and access it.
IMPORTANT
Please be sure to back up the site and database before granting us access.
If you can't see the "wp-admin / FTP" fields, your post and site login details will be set to "PUBLIC". DO NOT publish the data unless you see the required wp-admin / FTP fields.
The private reply form looks like this: hidden link
The next time you reply, click on "I still need assistance".
Video: hidden link
Please note that we are obliged to request this information individually on each ticket. We are not allowed to access any credentials that were not specifically submitted on this ticket in the private response form.