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.
Tagged: Exception
This topic contains 9 replies, has 2 voices.
Last updated by Bruno Kos 1 year, 1 month ago.
Assisted by: Bruno Kos.
Author | Posts |
---|---|
March 1, 2024 at 5:42 am #15360930 | |
aaronK-11 |
I am trying to: hidden link template redirect to hidden link When I enable WPML the redirect stops working. I have installed WPML on Dev Environment. Link to a page where the issue can be seen: hidden link shows too many redirects I expected to see: hidden link it will open this page properly Instead, I got: Too many redirect issue. Below is the code for template redirect which is working fine when WPML is disabled for reference: add_action('template_redirect', array($this, 'redirect_kids_home')); /** * Redirect kids home page to archive page */ public function redirect_kids_home() { if (is_singular('lps-kids')) { $uri = trim($_SERVER['REQUEST_URI'], '/'); $query_string = sanitize_text_field($_SERVER['QUERY_STRING']); if ($query_string) { $uri = trim(str_replace('?' . $query_string, '', $uri), '/'); } if ($uri !== self::$kids_page_slug && get_page_template_slug() === 'page-home-kids') { $redirect_url = home_url(self::$kids_page_slug); wp_safe_redirect($redirect_url, 301); exit; } } } I have debugged this code and I was not able to find anything. Please guide further. |
March 1, 2024 at 8:28 am #15361321 | |
Bruno Kos WPML Supporter since 12/2018
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+02:00) |
Hi, Thank you for contacting WPML support! Can you add your code here? And tell me where can I see the issue? Regards, |
March 1, 2024 at 12:22 pm #15362893 | |
aaronK-11 |
Hi, Thanks for quick response can I add you as a user in the site I am having issue. And you can check the issue there. as same code implementing in your new site will be time consuming. Please share you email and I will create a user for you. |
March 1, 2024 at 12:26 pm #15362897 | |
Bruno Kos WPML Supporter since 12/2018
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+02:00) |
I marked your next reply as private so that you can safely add credentials. Also tell me where did you add the code. |
March 1, 2024 at 1:09 pm #15363110 | |
Bruno Kos WPML Supporter since 12/2018
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+02:00) |
I am checking this with our 2nd tier and will get back to you. |
March 4, 2024 at 6:57 am #15367583 | |
aaronK-11 |
Hi, May I know if you have found anything regarding this issue. Thanks! |
March 4, 2024 at 7:38 am #15367766 | |
Bruno Kos WPML Supporter since 12/2018
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+02:00) |
I have no news on the matter yet. |
March 4, 2024 at 3:55 pm #15371106 | |
Bruno Kos WPML Supporter since 12/2018
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+02:00) |
When WPML is not active hidden link shows the content of this page hidden link Kids is the slug of CPT and should display the archive page, so why does it work this way? Is there any tweak beyond this? If so, can you give us details? |
March 5, 2024 at 10:52 am #15373793 | |
aaronK-11 |
It is meant to display the kids home page using I have shared the code for the same in the thread. If we disable WPML this will work. |
March 6, 2024 at 8:57 am #15377943 | |
Bruno Kos WPML Supporter since 12/2018
Languages: English (English ) German (Deutsch ) French (Français ) Timezone: Europe/Zagreb (GMT+02:00) |
I see, but we cannot debug the whole theme, given that this is https://developer.wordpress.org/reference/hooks/template_redirect/ function, there needs to be a way to test this in our sandbox with bare minimum code. Only then we can debug this, because as of now we have no such reports so it is possible that something within your theme is also influencing this and we don't debug custom themes. Let me know and I will prepare a new sandbox. |