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

Last updated by Yvette 1 year ago.

Assigned support staff: Yvette.

Author Posts
September 18, 2018 at 10:48 am #2744687

flavioP

Hello, I have a website with English as first language and Norwegian as second.

I have created a post type:
ENG: Medical treatments -> URL /medical-treatments/
NOR: Behandlinger -> supposed URL /behandlinger/

I can see the right values for both in WPML -> Settings -> Post types translations and in WPML -> String translation, but in the final post in Norwegian the URL displays the English slug (see picture).

Thank you for your help!

September 19, 2018 at 7:47 am #2747579

Yvette
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+02:00)

Hello

1. Technical Information on you environment
Could you please provide information about your environment by following thsese steps: http://wpml.org/faq/provide-debug-information-faster-support/

2. Clarifications
2.1, Please send a link where I can see the wrong URL.
Is this a single view template? an archive page for these custom posts?

2.2 Could you send me the function/code that defines your custom post?

3. Diagnostics
If you temporarily deactivate your non WPML plugins does the same thing happen?

Thanks

September 23, 2018 at 12:17 pm #2758595

flavioP

Hello Yvette, after checking further in this forum and elsewhere I believe the problem can be due to the Custom Post Type Permalinks plugin, which is actually the only solution I have found to create the following URL:

Custom post type: /hotels/ (/hoteller/ in norwegian)

Custom taxomony hotels: various Italian regions (/tuscany/, /sardinia/, /apulia)...)

Post in custom post type: mysite.com/hotels/tuscany/name-of-hotel/

Until here all is fine, but if switch to the same page in norwegian what I get is:

mysite.com/no/hotels/tuscany-no/name-of-hotel-no/

In practice the basic URL for the CPT is not translated.

If I deactivate the Custom Post Type Permalinks plugin it works, but without the taxonomy in the URL:

mysite.com/no/hoteller/name-of-hotel-no/

And in practice the URL should be:

mysite.com/no/hoteller/tuscany-no/name-of-hotel-no/

Any suggestion would be appreciated. Thank you.

September 24, 2018 at 11:13 pm #2761897

Yvette
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+02:00)

So I understand that this is a compatibility issue with the plugin:
Custom Post Type Permalinks

You would like to have the URL permalink in this format:
%post-type%/%taxonomy%/%postname%/

But the problem is that only the tags %taxonomy% and %postname% are being translated. This is expected as the post-type name is, in fact, not a tag and seems to be hard-coded by the plugin.

On the other hand, without this plugin, you are not able to get the custom taxonmy slug included in the post type URL. The standard Wodpress tags are not sufficient for your needs.

I found this article that explains this situation and possible solutions
hidden link

In your case, I can offer is that we open a compatibility ticket to have our compatibility team study how this plugin might be able to become compatible with WPML. I have to warn you, however, that the process can be long...and sometimes not even happen as it depends very much on the complexity of the issue as well as on the willingness and availability of the plugin author to work with our team.

Please note that it is not our policy to change code that was not written by our own programmers. But, if a solution/workaround is found, it will be shared with you. However, the final solution will come from the plugin author. If you choose to implement the workaround, it is with the understanding that we will not support it...you install it "as is" and at your own risk,. The final solution must/will always come from the plugin author.

AS AN ALTERNATIVE approach, you can try to code your own solution as described in the article and incorporate the WPML API filters at the right place to put in the correct/translated slug during the URL rewrite:
https://wpml.org/documentation/support/wpml-coding-api/wpml-hooks-reference/
If you are not a coder, you can get a contractor to help you
https://wpml.org/contractors/

Conclusion:
1. Have I understood the problem correctly?
2. Do you wish to proceed with a compatibility ticket understanding that this can take a long time to reach resolution?

Thanks

The topic ‘[Closed] Translating post type URL’ is closed to new replies.