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 1 reply, has 1 voice.

Last updated by thomasB-123 7 months, 3 weeks ago.

Author Posts
October 7, 2019 at 9:35 pm #4710847


The default language of my site is Swedish. I use WPML to translate it to English.

I create a custom post type with the slug 'contributor'.

In the string translation interface the slug is flaged as Swedish. But is actually Engish. So I check it at press the button that let me change the langiage to English.

Next I translate the slug from English to Swedishh. The Swedish slug is 'medarbetare'.

Now, when I visit the Swedish archive '/medarbetare', I see all posts of this type.

But, when I visit the English archive '/en/contributor', I get 404.

Taking a look at the query I see that '/medarbetare' has the query `[query] => Array ( [post_type] => contributor )`, but '/en/contributor' has the query `[query] => Array( [page] => , [name] => medarbetare )`

I've tried all the standard things like flushing all caches (including rewrite cache, object cache and wpml cache), save and re-save, rebuild wpml string database and so forth.

Is this a bug? Or is there a simple solution?

October 8, 2019 at 6:24 am #4712459


CPT:s has several slugs and they don't need to be identical. That's was my case.

What I started with: The post type slug was `contributor` while the archive and rewrite slugs where `vem`. The latter two was translated by string translation to `who`.

What I did to create the issue: I changed the archive and rewrite slugs to be the same as the post type slug, i.e. `contributor`. Now, this shows up as a Swedish in the translation interface, so I changed that to English as described previously and then translated it to `medarbetare`. That created my issue.

I solved the issue by reverting the database to what I started with, then changing `vem` to `medabetare` and translating the latter to `contributor`. Thus, the main difference is that I didn't change the language on the slug.

This is an acceptable solution, but not perfect. I've created the CPT with the CPT UI plugin, but want now to replace it with a simple mu-plugin that register it. In that plugin I would prefer to have all strings in English, and provide a .mo-fie with translation. It was in preparation of this I did the changes.

Obviously that screwed things up for WPML. I consider that as a bug, or at least a deficiency, in WPML. What I tried to do was logical and possible through the UI, therefore WPML should have accommodated it, but didn't.

So please consider this as a bug report.