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.

You are not logged in. You can view support threads, but not post.
If you are already logged in, please refresh your browser.

This thread is resolved. Here is a description of the problem and solution.

Problem Description: In some cases, the post is redirected to the translation.

Solution:
We provided a fix in https://wpml.org/errata/redirect-loop-using-slug-different-posts/ but unfortunately, this was not working in your case.

In some cases, the issue is deeper. Please add the following snippet in your functions.php file:

function fix_35012_wp_old_slug() {
    global $wp_query;
 
    if ( $wp_query->post_count > 0 ) {
        remove_action( 'template_redirect',  'wp_old_slug_redirect' );
    }
}
add_action( 'template_redirect', 'fix_35012_wp_old_slug', 5 );

Related documentation: Language URL Options

This topic contains 34 replies, has 8 voices, and was last updated by  fabrizioL-4 1 year, 5 months ago. The support staff assigned to this topic is Pierre.

Author Posts
Author Posts
December 11, 2015 at 4:21 pm #767179

Dirk

Please have a look in the private message. The problem is now on my staging site.
I downgraded my live site back to WP 4.3.1. so that my visitors can read the posts without troubles in Dutch.
You need to check http://www.staging1.outandabout.be/baanbrekende-osprey-atmos-rugzak/
There the site is on WP 4.4.

December 11, 2015 at 4:34 pm #767211

Eduard

Hi,

Thanks for details.
I'm escalating this ticket for further debugging.

Thanks

December 11, 2015 at 5:03 pm #767258

dianavcarrico

Hey guys. I was having the same problem with some products on woocomerce, for example, a product X in the english store was linking to Product Y in the portuguese store. I did everything Dirk did as well and nothing worked. Then, I tried something else. Duplicate one product, just to test it, see if it links to the right product page and then add it to the menu to test it and it is working!!! I don't know if it will do the same effect with posts but maybe it's worth the try. Yes, I have to do this to a couple of products which takes time but at least I figured out something. This was driving me crazy for the last 3 days, because nothing was working since the last upgrade! Hope it helps!
- Diana

December 12, 2015 at 2:02 pm #767653

Dirk

In the meantime I created another test environment with WP 4.4, just for myself, because I was wondering if your Beta version 3.3.4-b2 could solve the problem. In fact things even get worse.
When clicking my Dutch article it is still redirected to the English version but the browser falls in a kind of loop and keeps on loading/refreshing the post again and again.

I also want to let you know that deactivating WPML messes up my posts. What I want to say is that some (not all!) posts are showing up in English on the Dutch page, while English is the translation from my original Dutch language. So, even with WPML deactivated I can't use my site anymore.
The whole thing starts to worry me seriously now ­čÖü

Anyway, my live site is still on WP 4.3.1 without any problems.
My staging environment on WP 4.4 which I mentioned in my private message is still there for you for debugging.

December 13, 2015 at 12:27 am #767720

misoG

Seems that with every new version there is a new major problem or two introduced that wasn't there before... makes you wonder should we lay off updates for a while until you guys figure it out in latest versions and release fixes to those.

December 15, 2015 at 7:43 pm #769962

Dirk

Is this ticket still taken care of ? It dates from Dec 9... Sorry for asking, I realize support is very busy these days.

At this stage I am guessing it is a permalink issue. Because when I change permalink settings to 'numeric' the problem is solved. Just found out today.
When I set it back to 'post name' the problem returns. Resaving does not solve the issue.

Also interesting to know, when I set the permalink as 'default' my English translations return as a 404 error.

December 15, 2015 at 7:56 pm #769975

Pierre
Forum moderator

Supporter languages: English (English ) French (Fran├žais ) Portuguese (Brazil) (Portugu├¬s )

Supporter Timezone: Pacific/Pago_Pago (GMT-11:00)

Hello Dirk, this is Pierre from 2nd tier support.

Sorry for my late reply but the forum is currently overloaded.

In order to investigate more I would like to deploy a snapshot of your site on my local server. Could you provide a "light" Duplicator package (100Mo max)? You can exclude non-relevant folders using the filter (depending on what you have at the root of your web folder). You can also exclude the wp-contents/upload folder and any media files.

I am waiting for your feedback.

Regards,
Pierre

December 15, 2015 at 8:03 pm #769986

markusO-3

Hi

My problem was probably slightly different to yours (I had a pure redirect issue, which killed some translations), but we finally figured out that it was an WP4.4 issue. You might want to read this:

https://wpml.org/forums/topic/hi-several-posts-on-my-website-return-a-page-too-many-redirects/#post-766791

and

https://core.trac.wordpress.org/ticket/35012

After making the adjustments to the standard theme, the redirect disappeared. The author of my usual theme now looks into this, but reckons that WP4.4.1 will solve this soon.

Regards
Marc

December 15, 2015 at 8:09 pm #769991

Dirk

@marc
Thanks for the info. I tried that solution but it does not work in my case ­čÖü

@pierre,
Thanks for coming here so fast ­čÖé
Just want to remind you that the issue is NOT on my live site because I was forced to downgrade back to the previous version of WP.

The problems are now active on a staging environment (with WP 4.4).
http://www.staging1.outandabout.be/

In the private message above you will find all login info, so you can go ahead there.
I installed the duplicator already for you, but further than that I am not familiar with.
Can you please give it a try ?
That staging area is free for you to experiment. I have plenty of backups.

Thanks for helping.

Dirk

December 16, 2015 at 11:54 am #770486

Pierre
Forum moderator

Supporter languages: English (English ) French (Fran├žais ) Portuguese (Brazil) (Portugu├¬s )

Supporter Timezone: Pacific/Pago_Pago (GMT-11:00)

Hello Dirk,

In order to filter unnecessary folders and make the snapshot light, I need to request an access to your FTP server. This will allow me to see which folders I can exclude.

You can provide FTP credentials in your next private reply.

Regards,
Pierre

December 17, 2015 at 1:06 pm #771536

Pierre
Forum moderator

Supporter languages: English (English ) French (Fran├žais ) Portuguese (Brazil) (Portugu├¬s )

Supporter Timezone: Pacific/Pago_Pago (GMT-11:00)

Hello Dirk,

I found the issue which is related to a known bug in WordPress (https://core.trac.wordpress.org/ticket/35012 or https://core.trac.wordpress.org/ticket/35031).

We provided a fix in https://wpml.org/errata/redirect-loop-using-slug-different-posts/ but unfortunately, this was not working in your case.

I managed to find another fix which solves the issue on your snapshot. Please add the following lines in your functions.php file:

function fix_35012_wp_old_slug() {
	global $wp_query;

	if ( $wp_query->post_count > 0 ) {
		remove_action( 'template_redirect',  'wp_old_slug_redirect' );
	}
}
add_action( 'template_redirect', 'fix_35012_wp_old_slug', 5 );

Please let me know if this solves your issue (and we will update our errata page).

Regards,
Pierre

December 17, 2015 at 1:18 pm #771551

Dirk

Hi Pierre, on my staging environment I am using twentyfourteen as theme, with all non-WPML plugins deactivated. I put the above code inside the theme's functions.php (below). That's correct, right ?
Unfortunately there is no change. I still can't get to the Dutch articles.
Just to make sure that we are looking at the same thing ... the issue is on some posts, not all.
This one is an example where you can still see the issue. There are more however.

http://www.staging1.outandabout.be/baanbrekende-osprey-atmos-rugzak/

If you want to test further inside my staging site, please go ahead.

Hope this will lead to a solution soon.

Thanks.

Dirk

December 17, 2015 at 1:22 pm #771556

Dirk

Oh wait a minute ... I just put the code a bit higher in functions.php and suddenly it worked !!
Give me some time to test it on my live site tonight. I will come back here immediately to let you know. I'm excited however. Can't wait to test it live.

December 17, 2015 at 1:28 pm #771562

Pierre
Forum moderator

Supporter languages: English (English ) French (Fran├žais ) Portuguese (Brazil) (Portugu├¬s )

Supporter Timezone: Pacific/Pago_Pago (GMT-11:00)

Great! Just let me know if we can close this ticket.

Regards,
Pierre

December 17, 2015 at 7:36 pm #771938

Dirk

OK, I managed to solve the problem on my live site. However, not without some extra issues.

1. We already knew that on my site with ALL non-WPML plugins deactivated and with twenty-fourteen as basic theme, the problem was present.

2. Adding your second code in the theme's functions.php, not below but somewhere in the middle, solved the issue.

3. Then I changed my site back to my normal theme and added the code also, followed by upgrading WP to 4.4. With all plugins remaining deactivated the issue was still solved.

4. Then I reactivated my plugins and ... guess what ... the problem was back !

5. I deactivated again and started to test by activating all my plugins one by one.

6. This way I found out that only NextGEN gallery (version 2.1.15) made the problem return.

My conclusion is now that the code fix is necessary to solve the issue, but with NextGEN gallery unfortunately deactivated. I am going to start a ticket with their support too.
In the mean time there is no other way then to find an alternative for NextGEN to show my galleries, till they (or WP) fix the problem permanently.

Anyway, I am happy with the way you solved my problem. I feel that many people started to get a lot of trouble after updating to WP 4.4.

You are not logged in. You can view support threads, but not post.
If you are already logged in, please refresh your browser.