Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client was experiencing an issue where the permalink slug for a custom post type was not translating correctly, leading to a 404 error on the translated version of the page.

Solution:
We discovered that the problem was caused by the Redis Object Cache plugin. Once we deactivated this plugin, the permalinks started working correctly. If you're experiencing a similar issue with permalinks not translating on your custom post types, we recommend trying to deactivate the Redis Object Cache plugin to see if that resolves the issue.

Please note that this solution might be irrelevant if it's outdated or not applicable to your case. If deactivating the Redis Object Cache plugin does not solve your problem, or if you encounter any other issues, we highly recommend checking the related known issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the issue persists, please do not hesitate to open a new support ticket with us.

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.

This topic contains 4 replies, has 2 voices.

Last updated by Christopher Amirian 9 months, 1 week ago.

Assisted by: Christopher Amirian.

Author Posts
April 28, 2024 at 10:28 pm #15574321

mattiaO

Hello, I have a problem with wpml and my custom post type. The slug of the permalink is not translated, even if I translated it in the string section.
The italian version (default language) works just fine. When using a translated version, for example german, the link on the big arrow pointing to the right links to /de/offerte/long-stay-10/ instead of /de/angebote/long-stay-10/ and thus receiving a 404 error when clicking it.
Please note that the page /de/angebote/long-stay-10/ exists (even if not correctly translated).

The big arrow gets the link with the function: get_post_permalink()

Thanks for any help!

Istantanea_2024-04-29_00-11-30.png
Istantanea_2024-04-29_00-11-16.png
Istantanea_2024-04-29_00-10-57.png
Istantanea_2024-04-29_00-09-49.png
Istantanea_2024-04-29_00-08-53.png
April 29, 2024 at 3:29 pm #15577986

Christopher Amirian
Supporter

Languages: English (English )

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

Hi there,

Would you please go to WordPress Dashboard > WPML > Settings > Post Types Translation.

Find the custom post type in question and you will see a link to translate the base slug of the custom post type there.

Please Make sure that it is translated correctly there.

After that please do as follows:

- Go to "WordPress Dashboard > Settings > Permalinks".
- Click the "Save" button to flush the permalinks cache.

If the problem is fixed then great, if not, please consider changing the code that retrieves the permalink with the WPML hook below:

https://wpml.org/wpml-hook/wpml_permalink/

Thanks.

Screenshot 2024-04-29 at 19.27.50.png
April 29, 2024 at 9:25 pm #15578845

mattiaO

I did it as you said, as I did many times but the translations are NOT saved!

I see a lot of "PHP Deprecated:" lines in debug.log, I can post them if you want but they don't seem related.

April 30, 2024 at 2:36 pm #15581768

Christopher Amirian
Supporter

Languages: English (English )

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

Hi there,

The deprecation notice means that the PHP functions will not work if you use later versions of PHP, the current version you use will have no issue.

Please make sure that you hit the enter key when you added the translations there to make sure they are saved.

If the problem persists, I'd appreciate it if you could give me the URL/User/Pass of your WordPress dashboard after you make sure that you have a backup of your website.
It is absolutely important that you give us a guarantee that you have a backup so if something happens you will have a point of restore.

Make sure you set the next reply as private.

Also tell me the name of the custom post type to ceck

May 1, 2024 at 8:28 am #15583390

Christopher Amirian
Supporter

Languages: English (English )

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

Hi Mattia,

WPML is compatible wth any plugin that creates custom post types using the standard WordPress method.

I found out that the issue is Redis Object Cache plugin.

As soon as I deactivated that plugin the permalinks worked ok.

Thanks.

May 2, 2024 at 6:31 am #15585633

mattiaO

Thank you very much Christopher, you nailed the problem.