This thread is resolved. Here is a description of the problem and solution.
Problem:
The client's domain is configured sitewide without a trailing slash, but the alternate link for the main page includes one, causing inconsistency.
Solution:
If you're experiencing this issue, we recommend the following steps:
- Ensure you back up your site for safety reasons.
- Add the following code to your
functions.php
file:
add_filter('wpml_alternate_hreflang', 'custom_wpml_alternate_hreflang_func', 10, 2);<br />function custom_wpml_alternate_hreflang_func($url, $lang_code) {<br /> if (is_front_page() || is_home()) {<br /> $url = rtrim($url, '/'); <br /> }<br /> return $url;<br />}
For more details, refer to the documentation on WPML alternate hreflang and is_front_page.
Please note that this solution might be outdated or not applicable 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 issue persists, 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.