Stop Yoast SEO Premium From Adding Redirect Automatically

Recently I added a new plugin called Yoast SEO Premium 16.6.1 to Wordpress. It has something called redirect manager which it will automatically adds a redirect when it detect a URL change. In most cases, it is a good thing as it prevents users from landing 404 error page.

However, if you are using it with Polylang 3.0.6, another plugin for multilingual, you will get some wonky behaviour. Every time you add a new post, it will automatically add a redirect from root path of a language(i.e to the new post that you have added(i.e So the end result is that your users can never reach the home page.

The Fix?

You probably found a solution on the official website here mentioning to add the following code to your theme functions.php

add_filter( 'wpseo_premium_post_redirect_slug_change', '__return_true' );

The good news is the source is the official website documentation. The bad news is it doesn’t work because it is deprecated on newer version of Yoast Premium.

The Real Fix

The issue is the name of the filter has changed, use the following to stop Yoast Premium from adding redirect automatically.

add_filter('Yoast\WP\SEO\post_redirect_slug_change', '__return_true' );


Compatibility issues are quite common in Wordpress. So be sure to test things out locally or on a test server(if you have one) before releasing your new update to the production.

Software Engineer in Singapore