Please make sure to update to WPML 4.3.5 and check our list of Known Issues before reporting

Hi, Amit here, I am the WPML Support Manager, our current ticket queue is high, update your WPML plugins and make sure you meet the minimal requirements for running WPML before reporting an issue please - many tickets are resolved doing that

Please look at our updated list of Known Issues and you can also use our support search to find helpful information and of course review our documentation before opening a ticket.

If you do need to open a ticket please make sure to provide us with all the needed information as described in this page

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 8 replies, has 2 voices.

Last updated by Bobby 2 weeks, 5 days ago.

Assigned support staff: Bobby.

Author Posts
November 6, 2019 at 5:56 pm

williV

Hi,

A while ago I opened a ticket about the plugin WPML redirect based on IP plugin where something was wrong: https://wpml.org/forums/topic/wpml-redirect-based-on-ip-plugin/
After the help of your support person Raja Mohammed everything was working fine, but now again, if you open the website coming from a Belgian IP, the message is shown to bring you to the Belgian store but it brings you to a detailed product page instead of the homepage where you are at that moment. the homepage is set to the shop page.
So when going to hidden link you get the message to be redirected and ideally you will go to hidden link but instead it brings you to hidden link

November 11, 2019 at 7:07 pm #4927621

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-08:00)

Hello,

I have tried testing this plugin on a local environment using the duplicator plugin but it is not working as expected.

At the moment I am creating a migration to our cloudways staging environment to further test.

In the meantime if possible, please update your plugin to its latest version along with the WPML plugins to their latest version (4.3.3)

Downloads page:
https://wpml.org/downloads/

Let me know your results please after updating.

November 12, 2019 at 10:58 am #4930917

williV

Hi Bobby,

Thanks for investigating.
I have updated the plugins but still the same issue...

rgds

November 13, 2019 at 7:08 am #4936039

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-08:00)

Thank you for updating me with your results!

I was able to migrate the live site onto our staging servers on Cloudways, I am currently further testing this and will update you with my findings.

November 14, 2019 at 12:12 am #4943547

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-08:00)

Hi There,

The issue that you are experiencing is not related to the earlier issue that was resolved by my colleague mentioned here https://wpml.org/forums/topic/wpml-redirect-based-on-ip-plugin/.

Instead, it seems to be caused either due to the wpml-redirect-based-on-ip-plugin plugin's code or your site's configuration.

Within /public_html/wp-content/plugins/wpml-auto-detect-and-redirect-by-ip/code/Popup.class.php Line 41

there is the following code that is responsible for getting the Page's permalink and once the permalink is retrieved then it is introduced into the WPML hook.

The WPML hook is working as expected but the issue is with the permalink that is served to it.

$wpmlP = get_permalink();

This code should ideally get the exact permalink of the page you are visiting.

For example, let's say we have the homepage at hidden link and another page at hidden link

The code should return the permalinks as shown but instead of showing hidden link in your homepage it retrieves hidden link which is why then in turn you are redirected to hidden link

To test this i added the same code within the header.php of a default theme such as Twenty19 and you can see that i get different results on my staging environment.

I have set the "about-us" page as the homepage.

[Result from get_permalink() from within your plugin's code]
[NOT OK]
hidden link

[Result from get_permalink() from within the minimal code of Twenty19]
[OK]
hidden link

In conclusion, the get_permalink() piece of code retrieves the Homepage URL as

hidden link

when it should simply receive it as

hidden link;

I have tried to reproduce this issue on a clean environment and i was not able to.

NOTE: The issue remains with WPML deactivated the hook still receives hidden link instead of the homepage URL

November 14, 2019 at 8:54 am #4944707

williV

Hi Bobby,

Thanks a lot for the in depth research, however, it is not fully clear what action I can take now to solve the problem. Do you have any idea?

Thanks.

November 14, 2019 at 5:56 pm #4949339

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-08:00)

My Results indicate that the issue here is when you set the "shop" as your homepage.

Instead of the WordPress Hook( get_permalink() ) , receiving the homepage URL hidden link , it retrieves the shop URL of the first product with the permalink structure chosen for the products hidden link

I have tested this without WPML present and just running simply the get_permalink() with a default theme and all your plugins deactivated and it still gets the wrong permalink when "Shop" is set up as the homepage, were on a new installation it worked as expected.

I have migrated your site on our cloudways staging environment for further testing and here you can see what i am reffering to with all plugins including WPML deactivated.

With all plugins deactivated the homepage URL permalink comes back with the product in it.

hidden link

The user access credentials should be the same as your live site.

Is there a possibility of any custom work within your environment that you can think of causing this behavior?

NOTE: In the front end you will see a permalink shown in the header that is the echo of get_permalink().

NOTE2: For contrast, you can also view my staging site here on my environment and see that the URL is showing correctly with a product within it.
hidden link

November 17, 2019 at 2:32 pm #4960405

williV

Hi Bobby,
Thanks for your reply again.
I have checked for the customizations and there are only 4 of them that are listed in the snippets. I have tried with disabling them but the issue still remains.
Is there anything else that I can do?
Thanks for your continued support.
rgds

November 18, 2019 at 6:52 pm #4967327

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-08:00)

Hi There,

Unfortunately as this is not directly being caused by WPML but rather it seems to be a WordPress related issue I would recommend contacting your host provider and the plugin's author as they might be able to provide some additional information but at the moment with WPML deactivated the permalink is still shown as the product permalink rather than just the homepage permalink.

NOTE: As of right now with the latest version of WordPress this seems to be an expected behavior when it comes to setting your Woocommerce Shop as the home page.

It seems that the permalink uses the first listed product's URL.

The topic ‘[Closed] WPML redirect based on IP plugin gives wrong landingpage’ is closed to new replies.