Thanks for your reply. I can see the issue now. Please allow me to escalate this to our 2nd Tier Support for further assistance. I will come back to you once I've feedback.
Thanks for your patience. I have a feedback from our 2nd Tier Support and this is what they mentioned.
On your staging site, the same post is registered with the same settings (as far as I can tell). The post type archives are enabled, and you can visit the archive here: hidden link
However, on the client site, even though archives are also enabled, they don’t work: hidden link
redirects back to the home page.
Whatever is causing that redirection is also preventing WPML from recognizing internal links correctly. If they stop doing whatever is triggering the redirect, it should resolve the issue.
Thanks a lot. I had no idea that a redirect on the post archive would affect WPML.
I have disabled archives and removed the redirect from the staging site. I am not sure if I need to edit/translate the posts to force WPML to use the correct links. But I did not be sure. On this page, for example, I still get the English links: hidden link
Is there anything else I need to do to make WPML use the correct German links?
Thanks for your reply. I've checked this page hidden link and it's still not working. Could you fix it so that I could consult our 2nd Tier Support for the second look if the issue persists?
Maybe I misunderstood, but hidden link and hidden link both throw a 404 (not found) now. That's what I would expect for a post type without an archive page and with the redirect removed.
These URLs used to redirect to the homepage, but no longer do so. It seems like a standard WordPress situation now.
Thanks for your reply. Could you enable archive for this CPT hidden link and make sure it doesn't redirect? Once you've done that, we will resave this hidden link and hopefully correct the internal links on its own.
Ok, I enabled the archive again. The redirect to the homepage is still removed. However, what happens is that WordPress shows the content of a random post of that CPT if you request the archive URL. Probably because we don't use the WordPress archives and don't have a template for it. It's not unique for this CPT though.
Here's what's happening and what I guess is standard WordPress and should not affect WPML:
hidden link contains the content of hidden link
Similarly, for another CPT, hidden link contains the content of hidden link. But links are translated fine here, so this is unrelated to the WPML issue, I'd say.
I have updated hidden link and translated it, but still the links on the translated version are incorrect: hidden link
I'd rather have archives disabled, or the redirect enabled again, because URLs like hidden link are useless for visitors. But let's solve the WPML issue first.
Thanks for your patience. I have some feedback from our 2nd Tier Support, and this is what he requested. Could you provide more information regarding his request?
I can confirm that the archive issue is now fixed.
Looking at the page in question, the English source page is here: hidden link
Could you confirm if this page has been edited?
Direct link: hidden link
I am struggling to understand how the page is structured. In particular, the section with the problematic link, where exactly is it coming from? Check out the section that I've highlighted using a screenshot
Even when editing the page, I cannot locate it. It seems like it is being dynamically inserted somehow, but I cannot figure out by what.
Can the client clarify how this page is built, and more specifically, where that problematic section is being added?
Yes, the page has been edited but the links remained untranslated.
The page template is created with Kadence Theme (they call that Kadence Elements) and the problematic link in the top of the page is inside one the custom fields that I mentioned in my initial support request. In this case, it's the field "content_must_knows". The field can be edited under "Content must knows", all the way down in the block editor.
None of this should theoretically be an issue because we use the templates and fields sitewide and they caused no problems so far. The only difference is the new post type the links point to.
Within the same bullet list in the custom field, I added a test link to another post type and as you can see on hidden link, it translates fine. Also I added a test link to the new post type in the core content, and that translates fine too.
The URL in the button "Alle Gültigkeitsdetails ansehen" is a custom field too, and that translation fails as well.
So, my summary is: only links inside custom fields to this new post type fail to translate. Even though I set them to translatable in WPML, just like I did for other fields, and there it works fine.
I'm not sure what I'm missing and I guess it's some kind of rare WPML bug.
Thanks for your patience. I've received a feedback from our 2nd Tier Support and this is what we'll need to do.
1. Update all WPML plugins.
2. Deactivate the FluentSnippets plugin
3. Retranslate this page hidden link
4. Check the German language page and see if the links are corrected automatically.
Feedback from 2nd Tier Support : I note that they have a lot of custom code added via a FluentSnippets plugin, and a cursory scan shows that there is code related to manipulating Child posts queries. I'm not going to debug their custom code, but lets simply try disabling the custom code plugin altogether, and then try again to see if the links to Child posts are handled properly during translation.
WPML can't update for some reason. It keeps throwing the error "Update failed: undefined". As a test, I updated another plugin (non-WPML) and that worked fine, so I am not sure what the problem with WPML is. Feel free to take a look yourself.
On hidden link, I can see that since August 11, it reports "wpml: Unable to register: Site key not matching". I don't know what that means. The subdomain is registered as a staging site with WPML, so it should not be an issue.
Thanks for your reply. Could you generate a new sitekey here https://wpml.org/account/sites/ and then, replace it in WP > Plugins > Add new > Commercial Tab?
I managed to update the WPML plugins. The sitekey must have been wrong because the staging is a copy from live. I thought the license was domain-based, but I had to change the site key. Sorry about that.
Anyway, with WPML updated and FluentSnippets deactivated, I made a change to the English post and updated the translation. The links are still incorrect: hidden link
My new summary: only links inside custom fields to this new post type fail to translate. Even though I set them to translatable in WPML, just like I did for other fields, and there it works fine. It's not caused by custom scripts, and it also happens with the latest WPML version.
The topic ‘[Closed] Links to a new post type are not translated’ is closed to new replies.