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 thread is resolved. Here is a description of the problem and solution.

Problem: How to translate dynamic slugs that are created with a rewrite rule? Solution: Adding a rewrite rule is not working with WPMl but will be fixed in future versions. Nevertheless please check if the following suggested solution can work for you as well. Please see the Brief description (yellow background at the top of the ticket0 for the solution. https://wpml.org/forums/topic/rewrite-rule/

This topic contains 4 replies, has 3 voices.

Last updated by Itamar 3 months ago.

Assigned support staff: Itamar.

Author Posts
February 19, 2018 at 3:00 pm #1522363

Karsten

Hi,

I have set up a custom post type with category support. When calling the single template the url looks like hidden link

This 2 lines where setting up the CPT might be important to know for you:

'rewrite'				=> array('slug' => _x( $posttype_slug, 'URL slug Produkte', MKB_TEXTDOMAIN ) . '/%produkt_categories%','with_front' => TRUE),
'has_archive'			=> $posttype_slug,

In my default language everything works but in the translated (english) version it doesn't.

In WPML / Translation management /Multilingual content setup I did set the CPT to "translate" and set the checkbox to "... tranlate slug ...". The default value is displayed like this:
"produkte/%produkt_categories%" and the value I put into to the translation input field is:
"products/%produkt_categories%"

When translation a post in WP backend the permalink is displayed like I expected - for example:
hidden link

but when calling the url I get a 404 error. The archive isn't callable either. I rewrote the permalinks via WordPress settings/permalinks regulary after altering the WPML settings.

Unfortunately I can't paste an url or provide WordPress access but I could paste more code if nessessary of course.

I found this post from you:
https://wpml.org/de/documentation-3/ratgeber-zum-loslegen/ubersetzung-von-seiten-slugs/

But it didn't help - I guess it's because the rewrite/slug line is set up "dynamically" in my case.

Is there anything I can test - any help is much appreciated!

February 20, 2018 at 6:56 pm #1524083

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi.

It looks like you are adding a rewrite rule and that is currently not working with WPMl but will be fixed in future versions. Nevertheless please check if the following suggested solution can work for you as well. Please see the Brief description (yellow background at the top of the ticket0 for the solution.
https://wpml.org/forums/topic/rewrite-rule/

Regards,
Itamar.

February 21, 2018 at 11:03 am #1524721

Karsten

Hej Itamar, thanks for your response. I'm going to try the suggested solution. Would be nice of course if WPML could handle that but like you said maybe soon.

Best regards
Karsten

July 17, 2019 at 1:26 pm #4230531

Rémi

Hi,

I have the exact same issue, is there any news regarding the fix?
The solution described here doesn't work:
https://wpml.org/forums/topic/rewrite-rule/
Using the correct query var.

Thanks

July 17, 2019 at 2:03 pm #4231015

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi Remi.

This ticket is a year and a half old. Many things might have changed. Please open a new ticket in our forum with the issue that you have.

Best Regards,
Itamar.