How to Disable Yoast SEO Premium’s Automatic Redirects

Here’s the snippet that disables the automatic capturing of redirects in Yoast SEO Premium.

Yoast SEO logo
Last Updated:

This post may include affiliate links. Read more.

One of the key features of Yoast SEO Premium that sets it apart from the free version is the inclusion of a fairly robust redirection feature. It can do a bunch of things related to redirects, including regex redirections and serving 410s when you trash a post.

It can also monitor and automatically capture changed slugs and apply a 301 redirect pointing to the new URL. So if you edited the slug of a published post to make it more SEO-friendly or to remove stop words, when you resave the post, Yoast SEO Premium can automatically add a redirect from the old URL to the new one. (That’s also a feature the free Redirection plugin has.)

That can be a very handy feature. But I’ve found that things can also go a bit wonky. For whatever reason, on one of my sites, the feature went rogue and started saving an entirely new version of the post whenever I updated the content of the post (not the slug). So I was getting a new version of the post at a new URL and a redirection from the old URL to the new one.

That creates a real mess and is a problem for SEO. I don’t know precisely where the problem lies and have no easy way to diagnose it (or the inclination to spend the time diving in deep with Yoast support staff to figure it out). It’s possible it’s not even just the Yoast SEO Premium plugin causing the problem but some kind of weird interaction with something else going on in my WordPress install that’s now over 12 years old. But I’ve found a quick workaround that has solved the problem for me.

I’ve found that disabling Yoast SEO Premium’s automatic capturing of redirects solves the problem. No more duplicate posts being created with new slugs. Of course, it also means that I no longer get automatic redirects when I change the slugs of published posts, but I can live without that because I generally set the slug before I publish.

Snippet for Functions.php

This is the snippet I’ve used in my theme’s functions.php file:

// Yoast SEO Disable Automatic Redirects for Posts And Pages
add_filter('wpseo_premium_post_redirect_slug_change', '__return_true' );

As you can see in the code’s comment, this specific snippet applies to posts and pages. You can also apply it to taxonomies such as tags and categories. And you turn off the notifications when you delete a post or taxonomy term.

You can find more details about that here.

Things Worth Knowing

If something goes wrong with the functions.php file, it can create a white screen for your website. So it’s a good idea to back up your functions.php before you start so that you have a working copy to quickly restore. Restoring the backup version should get the site back up immediately.

David Coleman / Photographer
by David Coleman

I'm a professional freelance travel photographer based in Washington DC. Seven continents, up mountains, underwater, and a bunch of places in between. My images have appeared in numerous publications, and you can check out some of my travel photography here. More »

Leave a Comment