This thread is resolved. Here is a description of the problem and solution.
Problem:
The client noticed an unexpected x-default tag on their pages and wondered if it was due to a recent WPML plugin version upgrade. They asked if there was a way to deactivate it through the plugin interface or if there was a hook available for controlling it programmatically.
Solution:
We confirmed that the x-default tag was indeed automatically added in the WPML version 4.5.0 and that there is no built-in option in the WPML interface to switch it on or off. However, we provided a custom hook that can be used to control the x-default tag. Here is the code that the client can use:
add_filter( 'wpml_hreflangs', 'remove_xdefault' );<br />function remove_xdefault($hreflangs){<br /> foreach ($hreflangs as $key => $lang){<br /> if ($key == "x-default"){<br /> unset($hreflangs[$key]);<br /> }<br /> }<br /> return $hreflangs;<br />}
This code should be added to the theme's functions.php file or a custom plugin to remove the x-default tag.
Please note that this solution might be irrelevant if it's outdated or not applicable to your case. If the issue persists, we highly recommend checking the related known issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If you still need assistance, please open a new support ticket.
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 5 replies, has 2 voices.
Last updated by 2 years, 10 months ago.
Assisted by: Mihai Apetrei.