Skip Navigation

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

Problem:
I'm using this method https://wisdmlabs.com/blog/add-taxonomy-term-custom-post-permalinks-wordpress/ to create a CPT, my custom taxonomy and a rewrite rule to add taxonomy terms to my permalink structure. I'm trying to translate my Custom post type slug using WPML. I have already translated the content of the slug using WPML, but I have got a 404 error.

Solution:
This would require some custom rewrite rules via "add_rewrite_rule".

The client found an alternative workaround using a plugin called "Permalink Manager Lite":
https://wordpress.org/plugins/permalink-manager/

Relevant Documentation:
https://codex.wordpress.org/Rewrite_API/add_rewrite_rule

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 13 replies, has 2 voices.

Last updated by antoineA-4 4 years, 8 months ago.

Assisted by: Radu.

Author Posts
July 27, 2020 at 4:09 pm #6685035

antoineA-4

Hi,

Im' trying to translate my Custom post type slug using WPML.
I have already translate the content of the slug using WPML see attached but i have a 404 error.

French version (default language) : hidden link
English version : hidden link

Can you help me.
Thanks.

Capture d’écran 2020-07-27 à 18.07.46.png
Capture d’écran 2020-07-27 à 18.07.18.png
July 28, 2020 at 11:13 am #6691457

Radu

Hey Antoine,

Thank you for reaching out to the WPML support!

Can you tell me if this is happening if you try to change the slug of a different post type maybe? What if you set with_front to true?

Also, can you go to WPML → String translation, search for the slug, and make sure that the translation is set as Translation is complete, please?
Last but not least, have you tried to flush the permalinks by going to Settings → Permalinks and just hit the Save Changes button? This is doing the trick most of the time when you get a 404 error.

Thanks,
Radu

July 28, 2020 at 2:04 pm #6693239

antoineA-4

Hi Radu,

Thanks for your return.
I still need help because it still doesn't work.

I'm using this method to create my CPT, my custom taxonomy and a rewrite rule to add taxonomy term on my permalink structure:
hidden link.

I have tried to set with_front to true but nothing change and i also save again permalinks but still don't work.

July 29, 2020 at 6:45 am #6697423

Radu

Hey Antoine,

Can you try to use a permalink without a taxonomy on it and tell me if you can translate it this way, please?

Also, it would be great if you could create the same custom post type and taxonomy here, on a clean website:
hidden link

You can add the code to the functions.php file of the Twenty Twenty theme. I just want to see if we can replicate this issue on a clean website so I can pass this to my colleagues for a closer look.

Thanks,
Radu

July 29, 2020 at 11:57 am #6699775

antoineA-4

Hi,

• To answer your first questions, if i try to translate the permalink without the taxonomy inside, that's work :
EN : hidden link
FR : hidden link

• I add exactly the same CPT and Taxo on your website with two test :
- The first one with just WPML Multilingual CMS activated. And with this solution, the permalink with the taxonomy works well but i can't translate the part before the taxonomy.
EN : hidden link
FR : hidden link

- The second one including WPML String Translation activated to have the capability to translate the first part of the permalink , but that doesn't work :
EN : Error 404 : hidden link
FR : hidden link

Let me know and thanks for your help.

August 3, 2020 at 10:46 am #6725491

antoineA-4

Hello,

Any news ? update ?
Thanks for your help.
Simon.

August 3, 2020 at 11:53 am #6726039

Radu

Hey Simon,

Sorry for this delay. I was checking this one right when you wrote to me the last message.

I checked this out and I was able to find a similar ticket about this. Can you have a look at my colleague reply right here:
https://wpml.org/it/forums/topic/tassonomie-nei-permalink-dei-cpt/page/2/#post-6479215

and tell me if the change he suggested is working for you, please? Also, you can have a look at this too:
https://wpml.org/forums/topic/custom-taxonomy-of-term-with-post-name-url-issue/#post-4697057

Thanks,
Radu

August 3, 2020 at 12:25 pm #6726167

antoineA-4

Hi Radu,

I still need assistance!
I tried this two solutions but i still have my problem.

Any other solutions ?
Thanks.

August 3, 2020 at 1:51 pm #6726745

Radu

Hey Simon,

Can you tell me what change have you made, please? I'm asking this because I can see that the URL totally changed:
hidden link

and it's no longer containing the opensciences/analyses/francais part, it's just analyse (the post type).

Thanks,
Radu

August 3, 2020 at 1:56 pm #6726799

antoineA-4

I had just trying something but it didn't work.
So i just come back like before.

August 4, 2020 at 7:55 am #6731409

Radu

Hey Antoine,

I checked this out and look for other tickets about the same topic, but I couldn't find a fix for this. I asked my colleagues to have a look at this in order to see if there's anything I'm missing out.

I'll come back here as soon as one of my colleagues is having a look at this (which it shouldn't take long).

Thanks,
Radu

August 6, 2020 at 8:30 am #6747141

Radu

Hey Simon,

I checked this one with my colleagues and they told me that you will need to create the rewrite rules by following the WP codex rules:
https://codex.wordpress.org/Rewrite_API/add_rewrite_rule

in order to have the taxonomy on the slug work with WPML.

Thanks,
Radu

August 6, 2020 at 12:09 pm #6749125

antoineA-4

That doesn't work but i found a solution using the plugin : Permalink Manager Lite
hidden link

Thanks for your help.