任意の状況で404を返す。
function page_not_found_404() {
$post_type = "post_type"
if( is_post_type_archive($post_type) || $post_type == get_post_type() ) {
if(!is_user_logged_in()){
status_header(404);
include(TEMPLATEPATH . '/404.php');
exit();
}
return;
}
}
add_action('template_redirect', 'page_not_found_404');
当たり前だけどインクルードを使っているのでテーマフォルダの中に404.phpがないと機能しないからね。