
よくある質問などをカスタム投稿で作る際、投稿個別ページが邪魔(不要)になるので
それ自体を作らせない方法です。
以前紹介したfunction.phpに記述するやり方で行います。
add_action( 'init', 'create_post_type' );
function create_post_type() {
register_post_type( 'custom_post',
array(
'labels' => array(
'name' => __( 'カスタム投稿' ),
'singular_name' => __( 'カスタム投稿' )
),
'public' => false,
'show_ui' => true,
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields' ,'comments' ),
'menu_position' =>5,
'has_archive' => true
)
);
}
赤字部分が変更した部分です。
管理画面からも「表示」という項目がなくなり、
意図しない検索エンジンからのヒットもなくなります。