[Resolved] Modification of internal links in ACF WYSIWYG field
This thread is resolved. Here is a description of the problem and solution.
Problem: If you're developing a theme with a custom post type and custom taxonomy, and you're using the ACF WYSIWYG field in a multisite environment with WPML, you might notice that internal links appear differently in the front end. This issue could be related to a conflict with the
wpml_translate_link_targets
filter in the ACFML plugin, particularly if you have a filter on the post type link to include categories in the URL. Solution: We recommend updating to the latest version of WPML. Please go to Plugins > Add new, click on the "Commercial" tab, and then click "Search for WPML Updates". Install and activate the latest versions of our plugins and check if the issue persists. If this solution does not resolve your issue or seems irrelevant due to being outdated or not applicable to your case, please visit our known issues page and confirm that you have installed the latest versions of themes and plugins. If the problem continues, we highly recommend opening a new support ticket at WPML support forum.
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.
You can try to go to \ACFML\Field\FrontendHooks::convertTargetLinks in wp-content/plugins/acfml/classes/Field/FrontendHooks.php
add an extra condition to:
Thank you for your response. I understand your concerns about the temporary nature of the workaround, especially with upcoming plugin updates overwriting the code.
This issue has been escalated to our development team to explore a more permanent solution.
For now, please continue using the provided workaround if it's functioning as expected. I also recommend subscribing to the thread you mentioned, so you'll be notified as soon as there are any updates.
I just ran into the same issue as nicolasG-15 and Chris from linked post. It's been a long time and nothing has been done to address this issue. The problem can make a lot of 404 link in all wysiwyg of a website, I find it very critical... Mostly because it is extremly difficult to identify the origin of the problem.
Do you have any updates about that ?
I manage the url pattern of a CPT + Custom taxonomy manually, and thus the 'wpml_translate_link_targets' filter completely destroy hrefs inside my wysiwyg, making 404 links.
As 'wpml_translate_link_targets' filter is not flexible enough with hooks inside to correct the default behaviour we should at least have an easy and clean way of disabling it.
After trying multiple fix, I managed to do a fix in functions.php, which is better than updating the plugin's files, but still not as good as a feature included in the plugin.
For helping others with the same problem, here's how I did it :