Home›Support›English Support›[Resolved] WPML overwritting cpt links in every language with another cpt's permalink
[Resolved] WPML overwritting cpt links in every language with another cpt's permalink
This thread is resolved. Here is a description of the problem and solution.
Problem:
I have two CPTs with an ACF relationship (1-n): software-area -> software-service. WPML is overwriting the permalink for every software service so that they point to their related area. This happens in every language, and when I disable WPML, the permalinks work properly.
Solution:
This is a known issue with LearnDash and the "Enable Nested URLs" option.
Good evening,
I have configurated and just started translating a development website and I encountered a strange error that I do not know how to tackle.
I have two CPTs that have an ACF relationship between them (1-n): software-area -> software-service. WPML is overwritting the permalink for every software service so that they point to their related area. This can be observed in the service grid of this page: hidden link
This happens in every language and when I disable it the permalinks work properly. I have reviewed the configuration regarding the cpts and everything seems fine, so I might be missing something.
In Spanish, I can see 6 items in the grid. 5 of them point to the same page hidden link. And only one, Salesforce, points to hidden link. In English, I can see only one item, Oracle JD Edwards. It also points to the same page hidden link.
I cannot understand how you have configured things on your site.
Can you please give me access to your site and explain where to go to see the configuration you mentioned above?
If you need further help with this, please share the access details to your site with me.
I'm enabling a private message for the following reply.
Privacy and Security Policy
We have strict policies regarding privacy and access to your information. Please see: https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/ **IMPORTANT**
- - Please backup the site files and database before providing us access. --
-- If you have a staging site where the problem can be reproduced, it is better to share access to the staging site.--
1. Which field group should I check?
2. How did you create the CPTs?
3. How did you make the rulership between them?
4. Is Elementor involved in displaying this section?
Good evening,
1: The field is "software-area-of-service" within the group "Software Services". However, I dont think the ACF field is the issue, because adding the posts in other pages or widgets also result in an overwritten permalink it seems that it is an issue with the CPT itself.
2: I created the CPT via code through a custom plugin. The only peculiarity I can think of is that permalinks for the CPT follows the rule: {host}/{area}/{service} through custom hooks.
3: One to many: A software area owns several software services, the relationship is defined via a ACF field that belongs to the service. Nonetheless, as I mentioned, this might not be the issue.
4: Elementor is indeed involved in displaying this section and also a custom query (but using another widget without the custom query does not solve the issue)
I'm not sure what screenshots would you find helpful so I´ve taken ones regarding the configuration of WPML, the CPTs code and the ACF field. If you need more please let me know.
According to what you wrote, the problem might be in the CPT code. Please try to isolate this issue.
If possible, get your site into a minimum environment. Minimum environment means switching to a default WordPress theme like TwentyTwenty-One and no plugins activated except WPML and the CPT custom plugin.
First, you will need to check if the problem persists when just the theme is switched to TwentyTwenty-One. If it persists, then deactivate all plugins except the WPML, its add-ons, and the CPT custom plugin. Then please check if the problem persists and report to me your findings.
**** Important! Please make a full site backup (files and DB) before you proceed with those steps****
*** If your site is live, you might want to try those procedures in a staging environment or a snapshot of your site on your local server or another server. ***
The solution discussed in the previous link worked for my case too, I just had to mark both CPTs as "Translatable: only show translated items" instead of using the fallback option and everything worked properly. It seems that WPML might have an issue with that config option and nested urls.