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.
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.
page
and attachment
too, use is_singular()
.
Commented
May 1, 2015 at 13:11