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.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | - |
- | 12:00 – 16:00 | 12:00 – 16:00 | 12:00 – 16:00 | 12:00 – 16:00 | 12:00 – 16:00 | - |
Supporter timezone: Europe/Zagreb (GMT+02:00)
Tagged: Bug
This topic contains 9 replies, has 0 voices.
Last updated by wernerT-3 1 week, 3 days ago.
Assisted by: Dražen.
Author | Posts |
---|---|
March 3, 2025 at 9:26 pm #16770926 | |
wernerT-3 |
Background of the issue: Symptoms: Questions: |
March 5, 2025 at 10:44 am #16777860 | |
Dražen Supporter
Languages: English (English ) Timezone: Europe/Zagreb (GMT+02:00) |
Hello, Thanks for contacting us. I just checked on the test site with the same settings/permalinks, and it works just fine with the latest WPML 4.7.1, so it could be something specific to your environment/website. Please create and share a staging site where we can check this issue further. I have enabled private reply. Thanks, |
March 5, 2025 at 10:47 am #16777882 | |
Dražen Supporter
Languages: English (English ) Timezone: Europe/Zagreb (GMT+02:00) |
Hello, you also say: "But the connected homepage for other languages like DE + FR can now only be reached like /de and /fr but not anymore under /de/ and /fr/ - those last to redirect to /de and /fr" But if I check your live website is see that /en redirect to /en/, so not sure what is expected behaviour for you on live / staging site. Regards, |
March 5, 2025 at 12:23 pm #16778414 | |
wernerT-3 |
Hi Drazen, Let me first reply to you last question: "so not sure what is expected behaviour" The expected behavior, which works up to at least 4.6.3 (and not anymore already in 4.6.8 - see previous ticket) - is that homepages can be reach under the URL with a slash at the end. Like /de/ and /fr/ - this does work for /en/ in the new version but only for the default language ( EN is default language ) and not for any language. On the Live site in our .htaccess file we redirect from /fr , /de , /en to respectively /fr/ , /de/ , /en/ ------------- In your first reply you state: "it works just fine" , but in your second reply you state "not sure what to expect". ------------ Since it is impossible to grand sftp access due to IP restrictions, I can only give you access to our staging environment and that iis already hard to do as this is a controlled environment connected to GitLab for deployments with separate .htaccess + wp-config.php deployments and connections - with specials connections NFS files for uploads and other shares. It would be much easier if we can setup a teams-call and I share my screen which you can takeover. ------------ A side-effect that I noticed is that the function "url_to_postid" neither works for these homepages: Failed to resolve URL: hidden link ------------- I did find a work-around for wpml redirecting /de/ ( or /fr/ ) back to /de or /fr This is my work-around: add_filter('redirect_canonical', 'check_wordpress_redirects', 99, 2); In local dev I use global.it.atos.net as the domain for atos.net (prod live site) When I would even invest time actually debug wpml code I might be able to pinpoint where your redirection doing this for /fr/ and /de/ but not for /en/ ... I hope this clarifies the issue more clearly and you will be able to replicate this behavior on you side. If not, if you can reach your language homepage with slash at the end, then there might be something wrong with the database content. since I never created a clean install. If you like to setup teams call that would be welcome as well. Just propose a date/time. Kind regards, |
March 5, 2025 at 12:50 pm #16778631 | |
Dražen Supporter
Languages: English (English ) Timezone: Europe/Zagreb (GMT+02:00) |
Hello Michel, Thanks for the detailed reply; it is really helpful. I was able to reproduce the issue and confirm your findings. I have now escalated this issue to our 2nd tier to check and escalate it further. I will update you when I have some news, it may take a day or two. Regards, |
March 26, 2025 at 12:03 pm #16862478 | |
Dražen Supporter
Languages: English (English ) Timezone: Europe/Zagreb (GMT+02:00) |
Hello, thanks for the patience. Our 2nd tier checked, and our opinion is that since the trailing slash is removed from permalinks, both languages should redirect to no slash. The results should be consistent. That's what we will try to fix. As for your case, you could add the following code (to functions.php or via Code Snippets) to strip the callback we add to the redirect_canonical filter so that the results will be the same as "do nothing". add_action( 'init', function() { global $wp_filter; $hook_name = 'redirect_canonical'; $priority = 10; $method = 'prevent_redirection_of_frontpage_on_secondary_language'; if ( isset( $wp_filter[ $hook_name ] ) && is_a( $wp_filter[ $hook_name ], 'WP_Hook' ) ) { $hook = $wp_filter[ $hook_name ]; // Make sure this priority exists if ( isset( $hook->callbacks[ $priority ] ) ) { foreach ( $hook->callbacks[ $priority ] as $unique_id => $callback_data ) { $callback = $callback_data['function'] ?? null; // The callback is likely [someObject, '...the callback name...'] if ( is_array( $callback ) ) { [ $object_or_class, $callback_method ] = $callback; // If the method name matches, remove it if ( $callback_method === $method ) { unset( $hook->callbacks[ $priority ][ $unique_id ] ); } } } } } }); Regards, |
March 28, 2025 at 2:09 pm #16873395 | |
wernerT-3 |
Hello Drazen, Since that you and your 2nd line support only have an "opinion", you better consult with someone who has authority to change the application and also the manuals. From the 1st screenshot in this thread (and my newly uploaded), you can clearly see that the language homepages should be accessible with the trailing slash ! This has always been the case, up to v4.6.3 after which it did not work anymore - but this due some coder not knowing the manual - since it was never introduced as a Structural Change. The coding sample you give, probable will fix the issue of redirection but will not correct the function "url_to_id" nor will it fix "home_url". Please escalate the issue. If then it really is decided to leave the bug as it is, then you will need to change the manuals as well and I will keep using my own fixes. Kind regards, |
March 28, 2025 at 2:20 pm #16873432 | |
Dražen Supporter
Languages: English (English ) Timezone: Europe/Zagreb (GMT+02:00) |
Hello Michel, Thanks for getting back. Sure, I will share your comment with our 2nd tier and our devs, and we will let you know the reply. Regards, |
March 31, 2025 at 8:29 am #16877997 | |
Dražen Supporter
Languages: English (English ) Timezone: Europe/Zagreb (GMT+02:00) |
Hello, please note that issue is escalated to our developers, and based on the provided info it will be decided which approach is correct. The issue is in the queue and it will take some time before we have a proper permanent fix. As for the screenshot, the example URLs don't appear to take account of the permalink settings but instead are based on the default permalink pattern, which does include a trailing slash. If needed, we will address this. Anyway, once I have more info from developers or a permanent fix is released, I will share it with you. Regards, |
April 1, 2025 at 7:37 am #16881636 | |
wernerT-3 |
Hello Drazen, Thank you for escalating the issue for a proper resolve. Do note that the trailing slash is only for homepages, not for any other page ! You can also have your default homepage on / (root) of your site (which neither has a name) we just choose to always display the language channel as this increases the security of the site hugely. Kind regards, |