This thread is resolved. Here is a description of the problem and solution.
Problem: The client is experiencing an issue where a specific URL on their site is being incorrectly redirected to a different URL, even though they are different pages. The client tried disabling WPML redirects and modifying the database and server settings, but the issue persisted. The client observed that the issue does not occur when WPML is disabled. Solution: We investigated the issue and found that the redirection problem persists even when WPML is disabled, indicating that the issue is not related to WPML. It was suggested that the problem might be due to WordPress or the server trying to guess the correct page based on similar slugs. We recommended that the client consult with their developer to explore further, possibly by using unique slugs for each page to prevent incorrect guessing by WordPress or the server. Additionally, we advised that our support for custom-coded solutions is limited, and for issues related to custom code, the client might consider hiring a contractor from https://wpml.org/contractors/.
If this solution does not resolve your issue or seems irrelevant due to being 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 problem persists, please open a new support ticket at https://wpml.org/forums/forum/english-support/.
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.
Background of the issue:
I am trying to access a specific page on my site, hidden link, but it seems to be redirected incorrectly. We have attempted to disable WPML redirects for /vacature/ by adding custom code, removed records from the _icl_translations database table, and cleared all caches and transients. Despite these efforts, the issue persists. The code we used is as follows: add_action('init', function () { if (strpos($_SERVER['REQUEST_URI'], '/vacature/') !== false) { remove_filter('request', 'wpml_permalink_redirect_filter', 99); remove_action('template_redirect', 'wpml_template_redirect'); remove_filter('template_redirect', 'wpml_redirect_canonical', 1); } }, 0); add_filter('wpml_language_negotiation', function ($method) { if (strpos($_SERVER['REQUEST_URI'], '/vacature/') !== false) { return false; } return $method; }, 0); add_filter('redirect_canonical', function ($redirect_url) { if (is_singular('vacature')) { return false; } return $redirect_url; }, 0); add_action('wp_loaded', function () { $request_uri = $_SERVER['REQUEST_URI'] ?? ''; if (strpos($request_uri, '/vacature/') !== false) { remove_action('template_redirect', 'wpml_template_redirect'); remove_filter('request', 'wpml_permalink_redirect_filter', 99); remove_filter('template_redirect', 'wpml_redirect_canonical', 1); add_filter('wp_redirect', function ($location, $status) { error_log("Blocked redirect to: $location with status $status for URI: {$_SERVER['REQUEST_URI']}"); return $location; }, 1, 2); } }, 1); This adjustment had no effect, so we removed the code.
Symptoms:
The URL hidden link is redirected to hidden link even though they are different pages.
Questions:
Kun je deze bevindingen doorzetten naar WPML-support en vragen waar we nog meer kunnen zoeken of welke filter we moeten uitschakelen?
I checked further and issue happens even when WPML is disabled, also seems the URL redirect does not matter if the post exist in this URL or not.
Video: hidden link
For example if you change slug of page, it works fine but old URL still redirects:
- hidden link
- hidden link
Also since issue still happens without WPML it is not an WPML issue you will need to check further with your developer. Please also note in the future our help with custom coded solution is very limited as we can not support or debug your custom coded plugins /themes.
The issue is not happening when i disable WPML. Please see my video. It all goes well, until i activate the WPML plugins, then you see the URL is being redirected.
I checked but I have completely same behavior with and without WPML, issue still happens and page is redirected to /280/. This is kind of expected when you have pages with same or similar slug, WordPress / server is trying to guess correct page since for them it is similar / same and sometimes it guess correct and it works fine for you.
Video:
- hidden link
I am afraid you would need to continue further on this with your developer, or hire one since issue is not with WPML, and to be fair even if it was it is out of scope of our support to debug and support custom coded plugin / solutions.
Anyway, as I have shown in video, I advise checking further with developer who created the plugin and try using completely unique slug and making sure both pages open fine.
I hope you saw my video, where it doesn't happen when i disable WPML. On other websites there are no issues, it's only this one. Maybe it doesn't happen to you because of caching. I've tried it on different devices and it only happens when WPML is active. This is also what our developer says.
I tried my best to try and check issue to try and help out, but as you can see it doesn not happen for my side.
But as said before, this it out of scope of our support to debug and fix issue with custom coded plugins.
If you can show us issue without your custom plugin, with regular post / pages I can escalate this issue to our 2nd tier, or I can provide you test site where you can show us bug with WPML with regular post / pages or similar.