Resolved

Reported for: WPML Multilingual CMS 3.3.3

Resolved in: 3.3.5

Symptoms

Happened only with WordPress 4.4: When the translation of a post has the same slug as the original post (e.g. http://domain.tld/hello-world and http://domain.tld/fr/hellp-world) and then the slug is updated to reflect the translation (http://domain.tld/fr/bonjour-le-monde), the old slug is saved as _wp_old_slug, causing a redirect loop.

Editing a post translation slug which used to be identical to the original post (or any existing post), may cause a redirect loop.

Workaround

The issue can be resolved by upgrading to WordPress 4.4.1 (or greater).

This is a known issue in WordPress: https://core.trac.wordpress.org/ticket/35012

For WordPress 4.4, a workaround has been proposed and confirmed to work and requires to add the following code to the function.php file of your current theme:

add_filter( 'old_slug_redirect_url', function ( $link ) {
	if ( $link === get_the_permalink() ) {
		return '';
	};

	return $link;
} );

One Response to “Redirect loop when using the same slug in different posts”

  1. Hello, I had the problem with WP 4.4 and had to roll back, but apparently now that I tried with the latest version of WPML (today’s version) and WP 4.4.1 the problem seems solved.