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: America/Lima (GMT-05:00)

This topic contains 2 replies, has 0 voices.

Last updated by Andreas W. 3 days, 12 hours ago.

Assisted by: Andreas W..

Author Posts
January 28, 2025 at 3:55 pm #16642968

erikaN

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?

January 30, 2025 at 6:15 pm #16653215

Andreas W.
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hi,

It seems that the minimum requirements are not met on the server:
https://wpml.org/en/home/minimum-requirements/

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.

Best regards
Andreas

February 3, 2025 at 4:44 pm #16663807

erikaN

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.

I've kept it at 256M for now.

February 4, 2025 at 5:17 pm #16668051

Andreas W.
Supporter

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.

Best regards
Andreas

February 4, 2025 at 7:26 pm #16668342

Andreas W.
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

My apologies, but trying to access the site with the provided credentials I receive:

ERROR: The username or password you entered is incorrect.

Please verify the provided information.

The private reply form is enabled again.

February 4, 2025 at 7:48 pm #16668362

erikaN

Go ahead and try it again; should work now. For some reason the password didn't update. If it's still broken for you, let me know.

February 4, 2025 at 8:28 pm #16668450

Andreas W.
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

You do not have a Blog Page selected at Settings > Reading.

Make sure that such a page is assigned and translated.

February 4, 2025 at 8:47 pm #16668470

erikaN

Updated.

February 4, 2025 at 11:30 pm #16668719

Andreas W.
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

The issue seems to be this code inside the functions.php file of your Child Theme:


function change_blog_links($post_link, $id = 0)
{

    $post = get_post($id);

    if (is_object($post) && $post->post_type == 'post') {
        return home_url('/blog/' . $post->post_name . '/');
    }

    return $post_link;
}
add_filter('post_link', 'change_blog_links', 1, 3);
remove_action('wp_head', 'wp_resource_hints', 2);

I would not suggest setting /blog/ as base slug this way. WordPress by default will use the slug of your blog page.

If you remove this snippet the language switcher should work as expected.