Skip Navigation

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

Problem:
The client was experiencing issues with slug translations for the "Offer" tab in the menu and links to specific offer categories in different languages, which resulted in 404 errors or incorrect landing pages after updating any page in CMS.

Solution:
1. We recommended deleting the two strings related to the slug from String Translation.
2. We advised editing the code of the taxonomy by locating the

rewrite

array and replacing

'rewrite' => array( 'slug' => __('oferta','bp2') ),

with

'rewrite' => array( 'slug' => 'oferta' )

. This change prevents the slug from being localized using WP localization functions.
3. We instructed to navigate to WPML > Settings and add the slug translation for the taxonomy there.
4. We suggested resaving the permalinks on the WordPress site to ensure the changes take effect.
5. We asked the client to check if the issue was resolved after following these steps.

Please note that this solution might be irrelevant if it's outdated or not applicable to your case. If the issue persists, 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. If necessary, please open a new support ticket for further assistance.

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.

Tagged: 

This topic contains 13 replies, has 2 voices.

Last updated by pawelW-13 9 months ago.

Assisted by: Bruno Kos.

Author Posts
March 13, 2024 at 11:13 am #15403202

pawelW-13

Hello,

Once again the problem with slug translations on the production site hidden link and the development site hidden link has returned.

It's about the "Offer" tab in the menu and links to specific offer categories in different languages (DE, EN, SK, HU, LT) that the default site (PL).

View screen recordings -> hidden link

After updating any page in CMS for a while the filter/offer starts working, then 404 errors or weird landing page appear again.

We tried the solutions recommended by you (clear cache etc.), but it did not solve our problem. Also we threw away for a moment the entire template of the product listing page and when changing the language there was still a bug, so it is not a request issue.

The only thing that caused the 404 error not to be displayed was the removal of the slugs for "product_category" from the translations (leaving "oferta" everywhere), but this is not a solution because the slugs must be translated.

Take a peek at the CS version of the site, where the translation of "product_category" is the same as on the default page (PL), and there the error does not appear.

Please help me solve the problem. The matter is very urgent.
I suggest solving the problem first on the development site hidden link.

Zrzut ekranu 2024-03-13 114943.png
638ad223-faf0-4674-8c84-d8797f8e377b.jpg
March 13, 2024 at 3:42 pm #15405186

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+01:00)

Hi,

Thank you for contacting WPML support!

This product_category - is this a custom post type registered by your theme? As I see that you don't have WooCommerce, correct?

Perhaps this is compatibility issue, your theme not allowing for the slug translation.

Regards,
Bruno Kos

March 14, 2024 at 9:17 am #15408379

pawelW-13

Hi Bruno,

We don't use WooCommerce,

The theme allows the slug translation, otherwise it works fine. The problem is only with the offer.

Besides, this functionality once works and once doesn't and as if the slug translation is not compatible, it would probably not work at all, right?

March 14, 2024 at 9:20 am #15408381

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+01:00)

I see, so this is this a custom post type registered by your theme?

If so, we could try this in sandbox, only the theme and translate the slug to see how it behaves. Let me know if so and I will prepare a sandbox.

March 14, 2024 at 9:23 am #15408383

pawelW-13

Yes, this is this a custom post type registered by the theme.

Do you want an access to WordPress and FTP?

March 14, 2024 at 12:47 pm #15409963

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+01:00)

Ok, can you install this theme here?
hidden link

and translate the slug, does it work?

If working in the sandbox and not working in your site at the moment, can you provide us with this?
https://wpml.org/faq/provide-supporters-copy-site/

We will then debug the site as is.

March 18, 2024 at 10:34 am #15420321

pawelW-13

I tried to do it, however, it doesn't work and I can't check if everything is ok.

Besides, there are so many dependencies on the site that it would take a very long time to implement all of them on the sandbox, and consequently, at this point our tests will not be effective.

March 18, 2024 at 1:35 pm #15421450

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+01:00)

I see, so in our sandbox there is not 404, or? Because if there is 404, that would help us debug this more easily.

If not, can you send this for your site:
https://wpml.org/faq/provide-supporters-copy-site/

We need non-working site and then tell me where can I see 404, an example URL.

I will escalate the case to our 2nd tier then for further checks.

March 25, 2024 at 8:28 am #15445066

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+01:00)

I was able to create a package using Duplicator Pro.

Ok, I browsed through the site and noted this:

hidden link - this gives 404
but If I go to hidden link and click "Plechové strešné krytiny", it works, even though it is the same url as the above?
hidden link

So if opened directly this (and others) URL will hit 404, but not through filters?

March 25, 2024 at 12:21 pm #15446546

pawelW-13

Not exactly. Sometimes it works that way, and sometimes it doesn't. It doesn't make any sense.

hidden link

As I wrote, from our observations, the problem is the translation of the word "offer." In this case to "panuka".

March 25, 2024 at 4:04 pm #15447821

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+01:00)

I see, but whatever causes 404 in my case may be the cause of all issues.

I am checking this with our 2nd tier and will keep you posted.

March 26, 2024 at 11:28 am #15450862

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+01:00)

Escalated to 2nd Tier.

I will keep you posted.

March 27, 2024 at 9:50 am #15454400

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+01:00)

Can you please try the following:

1. Delete the two strings related to the slug from String Translation (see my image)
2. Edit the code of the taxonomy by locating the `rewrite` array. Replace

'rewrite' => array( 'slug' => __('oferta','bp2') ),

with:

'rewrite' => array( 'slug' => 'oferta' )

This prevents the slug from being localized using WP localization functions.
3. Navigate to WPML > Settings and add the slug translation for the taxonomy there.
4. Resave the permalinks on your WordPress site to ensure the changes take effect.
5. Check if the issue is resolved.

This process should correct the improper localization of the slug.

image.png
March 28, 2024 at 11:38 am #15460149

pawelW-13

Problem solved. Thank you!