Skip to content

Instantly share code, notes, and snippets.

@michael-sumner
Created September 5, 2023 15:23
Show Gist options
  • Save michael-sumner/8962e9081cd1d6d03bcca47ebed3b4a2 to your computer and use it in GitHub Desktop.
Save michael-sumner/8962e9081cd1d6d03bcca47ebed3b4a2 to your computer and use it in GitHub Desktop.
Disable WordPress core attempts to redirect old posts.
<?php
// Disable WordPress core attempts to redirect old posts.
add_filter( 'old_slug_redirect_post_id', '__return_zero' );
add_filter( 'redirect_canonical', '__return_empty_string' );
@michael-sumner
Copy link
Author

Note: There are issues with Redirection plugin which makes this solution not work.
Therefore, use with caution and test redirects from other plugins using the hook, thoroughly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment