Last active
December 22, 2017 01:01
-
-
Save tillkruss/5660075 to your computer and use it in GitHub Desktop.
Disable front-end blog functionality in WordPress, including categories, author archives, etc.
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 | |
add_action( 'template_redirect', function() { | |
global $wp_query; | |
if ( is_home() || $wp_query->is_singular( 'post' ) || $wp_query->is_post_type_archive( 'post' ) ) { | |
header( $_SERVER[ 'SERVER_PROTOCOL' ] . ' 404 Not Found' ); | |
$wp_query->set_404(); | |
} | |
}, 5); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment