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.

Our next available supporter will start replying to tickets in about 6.62 hours from now. Thank you for your understanding.

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

Problem: 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 );

Tagged: 

This topic contains 34 replies, has 8 voices.

Last updated by fabrizioL-4 3 years, 9 months ago.

Assigned support staff: Pierre.

Author Posts
December 21, 2015 at 7:38 am #773327

fabrizioL-4

Hi i followed this topic on wordpress support, a thread by DirkD, and now here, i'm not concerned by NextGen but i am a WPML user.
The fix works, though i wonder when will it be solved in a definitive manner?
Is the issue caused because the main language is not english?
Thanks for answers.

December 21, 2015 at 8:02 am #773348

Dirk

Hi fabrizioL-4, I believe you're not going to receive a reply here because this thread is marked as resolved. I also believed it was resolved from WPML's point of view, but when reading the support thread in NextGEN's forum I'm not sure anymore.

Fact is that the problem is solved when applying the WP code fix but in my case the problem returns with NextGEN active. However, they still keep telling me that it is a WPML issue, even when I wrote that it's happening also with WPML deactivated. In the NextGEN forum you will read that the problem also existed with Polylang as translation plugin, but the user who mentioned this got his problem solved after applying the code fix.

I'm not sure of anything anymore, because it's sad to say that WPML caused lots of issues already in the past. When installing, it digs very deep in the system. For example, when I deactivate all WPML plugins, some of my original Dutch posts suddenly appear in English only. That does not make sense either which makes me uncertain about WPML's responsibility here.

At this moment I am waiting for the 4.4.1 WP update and the NextGEN update which is expected on monday. We'll see where this will take us.

If you expect WPML to reply, I think you will need to open a new thread and link to this one.

Good luck.

December 21, 2015 at 8:07 am #773355

fabrizioL-4

Hi DirkD,
i'm sure it's from WPML, did you know the main language has to be english? i say this because a prior issue made me follow a thread which was talking about it. Any thanks for suggestions and good luck to you too.

December 21, 2015 at 5:48 pm #774083

Dirk

OK, so tonight both WPML and NextGEN were updated. It did NOT solve my redirecting issues.
The problem is definitely connected to these WP bugs :

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

It seems it has something to do with slugs being renamed and new pages generated with the old slug. I remember I changed some slugs a long time ago, so this does actually make sense. It is weird however, that the problems suddenly came up with 4.4.
The proposed code fixes still do not work for me, with NextGEN active.

Now, I solved my problem myself by renaming the slugs of the original affected posts. I left the slugs of the translations intact. Of course, this way I would generate 404 errors in Google searches, so I also created 301 redirects to catch them.
It was a huge job and I still don't feel good with this 'solution' but at least my posts work normally again, with new slugs for the original language (not the translations).

I do hope WP will come up with a working solution fast because now it seems we need to be very careful with handling our slugs.

I still don't understand the connection with WPML/Polylang/NextGEN...

December 21, 2015 at 6:03 pm #774101

fabrizioL-4

Hey Dirk, thanks for sharing.
Now it looks more clear, we'll at least there is a meaning to all this.
The old slug name is stored maybe for revision purposes? Though it make no sense to me, I guess all this noise will have them, either on plugin side either on wp core.
The temporary fix works fine, but cannot test it right away as I had to fix several production sites and spent most of my day informing clients about this issue.
I had to apply the fix to about 15 sites today.....