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

Last updated by Pierre 5 years, 3 months ago.

Assigned support staff: Pierre.

Author Posts
March 31, 2015 at 1:58 pm #591413

aquest-srlU

Hi,
I want to bring my experience about slug translation of single custom post type .
I registered a cpt as "portfolio", and used with this name in all around my theme.
If I don't use any rewrite rules a link to a single portfolio post could be hidden link.

After weeks I needed to change the url in works and the rules "rewrite" in CPT did really great the trick without have to change all reference of portfolio on code and without change reference on database from "portfolio" to "works".

Now the problem: WPML translate correctly all my slug if I keep the rewrite name the same as the CPT name like this:

 'rewrite' => array('slug' => _x('portfolio', 'URL slug', 'MYTHEME')) 

If I use rewrite to change also the base string language (English) like this:

 'rewrite' => array('slug' => _x('work', 'URL slug', 'MYTHEME')) 

will translate the source (www.mysite.com/work/my-work) in english, and in the other language (www.mysite.com/it/lavoro/my-work) but the URL (usually generated with get_permalink()), will build the uncorrect URL! (www.mysite.com/it/work/my-work)

So as you can imagine you'll get a 404 error.
Anyone have had the same problem?
Anyone have some workaround?

Is a limitation of wpml?
It could be an error of mine?

Any answer will apreciate, but I have yet checked at usual things (flush rewrite, option translate slug with string translation, translate with wpml etc etc etc).

Thank you in advice 🙂

April 1, 2015 at 7:53 pm #592438

Pierre
Supporter

Languages: English (English ) French (Français ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello,

Thank you for your message!

Actually, some users reported a bug related to custom post type rewrite rules occurring with WPML String translation 1.2.2: https://wpml.org/forums/topic/custom-post-type-slug-translation-not-working-in-3-1-9-4/

Can you check this thread and tell me if your case is related?

Otherwise, could you provide me with your debug information? Just follow these steps: http://wpml.org/faq/provide-debug-information-faster-support/

Regards,
Pierre

The topic ‘[Closed] rewrite url problem’ is closed to new replies.