Skip to content

Instantly share code, notes, and snippets.

@ControlledChaos
Last active July 17, 2018 13:08
Show Gist options
  • Select an option

  • Save ControlledChaos/4f9693d44ffc858d9672e7d372c98764 to your computer and use it in GitHub Desktop.

Select an option

Save ControlledChaos/4f9693d44ffc858d9672e7d372c98764 to your computer and use it in GitHub Desktop.
Stop WordPress attempts to guess the "correct" URL.

Disable Redirect Guess

WordPress Snippet

<?php
function ccd_no_redirect_on_404( $redirect_url ) {
if ( is_404() ) {
return false;
}
return $redirect_url;
}
add_filter( 'redirect_canonical', 'ccd_no_redirect_on_404' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment