Skip to content

Instantly share code, notes, and snippets.

@joseluis
Forked from tillkruss/disable-posts.php
Created December 16, 2013 11:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joseluis/7985699 to your computer and use it in GitHub Desktop.
Save joseluis/7985699 to your computer and use it in GitHub Desktop.
<?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