# 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.

- Type: PHP
- Runs: Run everywhere
- Category: [Disable Features](https://wpide.com/library/category/disable-features/)
- Tags: disable, redirects, permalinks
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/disable-old-slug-redirects/

## Code

```php
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 use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Stop Redirecting Old Post Slugs" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
