[Resolved] Split: Modification of internal links in Gutenberg
This thread is resolved. Here is a description of the problem and solution.
Problem: You are experiencing 404 errors on all links in translations using the WYSIWYG Classic editor or Gutenberg. This issue does not appear on your staging website. Solution: Ensure that the option 'Translate Link Targets' under WPML > Settings is enabled, as this resolved the issue on our test site. If this does not resolve your issue, check if the custom post type (CPT) archive and the taxonomy base are using the same slug 'recettes'. This is not recommended as it can cause conflicts in rewrite rules and lead to unexpected behaviors. Using different slugs for the CPT archive and taxonomy base may resolve the issue.
If these steps do not resolve your issue, or if the solution seems outdated or irrelevant to your case, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the problem persists, please open a new support ticket at WPML support forum for further assistance.
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.
It's the same on the parent site. You can see the post "Recipe link test". After publishing or saving, something change the link to .../?recipe_category=test-a instead of .../en/recipes/cat-a-en/test-a/.
Languages: English (English )Spanish (Español )German (Deutsch )
Timezone: America/Lima (GMT-05:00)
Thank you!
This seems to have a different cause, as the issue also occurs when the slug is not identical between posts, and the workaround is not solving the issue.
I will try to take a local copy of the site for testing and then get back to you.
Languages: English (English )Spanish (Español )German (Deutsch )
Timezone: America/Lima (GMT-05:00)
Hi!
I created a sandbox, included a CPT with custom taxonomy, and tried to recreate the issue using the Twenty Twenty-One theme.
So far, I can not confirm this issue on a new test site.
I then installed your theme, ACF PRO, and imported your Field Groups, also made sure that the CPT archive and category slugs are translated and the issue still does not occur on this sandbox.
See post "Test" here:
One-Click-Login: hidden link
Is it possible to deactivate plugins for testing on your provided Multisite?
I can't reproduce the issue on the One-Click-Login website. Gutenberg isn't working on it. Due to an error with lodash in global.js theme script.
For confirme the issue you have to :
1. Create a recipe in default language (EN)
2. Add translation of the recipe (DE)
3. Add link of the recipe in other part of the website with Gutenberg (in post for exemple) OR with classic editor
On my site I've deactivated all plugins except translation and ACF.
For the record, I did some additional tests.
The erroneous modification of a recipe link is only done in a custom post type, post or a page. If you add a link in a taxonomy term, the issue does not occure.
Perhaps we should look at the save_post action.
Languages: English (English )Spanish (Español )German (Deutsch )
Timezone: America/Lima (GMT-05:00)
Take kindly note that I was able to recreate the issue on our sandbox with a CPT and a custom taxonomy and escalated this issue as a bug.
The second-tier support realized that this issue disappears if you go to WPML > Settings > Translate Link Target and run the option to adjust internal links.
OK let's start from the beginning, you have to "forget" about the first subsite (RCG dispatching) it's just a HUB page for dispatch into the 2 other sites. On the first subsite indeed there is no post, no custom post type you are right.
The posts I talk earlier - and all my tests - is on the second subsite "Professionnal". Here you can do wathever you want.
Same for plugins you have super-admin access rights, I've just checked.
This looks like a multilingual slug setup — but _x() is a gettext function, and WPML cannot translate rewrite slugs via gettext (confirmed in WPML docs).
Slug in rewrite is fixed and untranslated
You’ve hardcoded 'slug' => 'recettes/%recipe_category%', but if 'recettes' isn’t dynamically filtered per language, it won’t change when switching languages.
Changing it to this solves the issue but you will need to update the existing translations: