1

I want know, How to disable single post view in wp. any plugin or setting???

Is there a way to disable single post page, for example when some tries to go to single post page to show not found or 404 page.

1 Answer 1

3

You can add to the end of theme's header.php file this:

if( is_single() ) {
  global $wp_query;
  $wp_query->set_404();
  status_header( 404 );
  get_template_part( '404' );
  exit();
}

Note that the get_template_part( '404' ) function needs 404.php file in your theme directory.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.