Created
January 30, 2019 09:56
-
-
Save RiodeJaneiroo/c49a9a84bb771a91a7bf7bf35c788195 to your computer and use it in GitHub Desktop.
[Fix url] #wordpress #seo
This file contains hidden or 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 | |
// fix when zero in end url | |
add_action( 'pre_handle_404', 'fix_fake_page' ); | |
function fix_fake_page( $false ) { | |
global $wp_query; | |
if ( is_singular() | |
&& isset( $wp_query->query['page'] ) | |
&& $wp_query->query['page'] === '0' | |
) { | |
$wp_query->set_404(); | |
status_header( 404 ); | |
nocache_headers(); | |
return 'stop'; | |
} | |
return $false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment