I believe that is the redirect_canonical
function hooked to template_redirect
. You should be able to disable it with:
1 2 3 4 5 6 7 8 9 10 | add_filter( 'redirect_canonical', function( $redirect_url ) { $url = 'http'.((isset($_SERVER['HTTPS'])&&$_SERVER['HTTPS']!=='off')?'s':'').'://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; if( $redirect_url !== $url ) { global $wp_query; $wp_query->set_404(); status_header( 404 ); nocache_headers(); } return false; }); |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.