Last active
June 21, 2017 11:12
-
-
Save petersplugins/e852568153f60d9617fe9c5f40efb8d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// This code snippet disables the URL autocorrection guessing feature of WordPress | |
// Add a custom function to disable autocorrection guessing | |
add_filter( 'redirect_canonical', 'stop_url_autocorrect' ); | |
function stop_url_autocorrect( $redirect_url ) { | |
if ( is_404() && !isset( $_GET['p'] ) ) { | |
$redirect_url = false; | |
} | |
return $redirect_url; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment