Stop Redirecting Old Post Slugs
Stops WordPress from redirecting a post's previous URLs after its slug changes, for when you want an old address to be free or truly gone.
Opens WPIDE on
Code
add_action( 'init', function () {
remove_action( 'template_redirect', 'wp_old_slug_redirect' );
} );
Notes
Links and search results that point to old slugs will return 404, which can hurt SEO.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.