Skip to content

Instantly share code, notes, and snippets.

@thinkstylestudio
Created August 23, 2012 02:19
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 thinkstylestudio/3431446 to your computer and use it in GitHub Desktop.
Save thinkstylestudio/3431446 to your computer and use it in GitHub Desktop.
Disables all posts on a blog.
// From http://wordpress.stackexchange.com/questions/44983/disable-single-post-page
add_action( 'pre_get_posts', 'single_post_404' );
function single_post_404( $query ) {
if ( $query->is_main_query() && $query->is_single() )
$query->is_404 = true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment