Wordpressのカスタム投稿タイプの詳細(個別)ページを作らない方法
Wordpress初心者の備忘録です。 カスタム投稿タイプで詳細(個別)ページが不要な時(よくある質問とか)の時の対処法です。
<?php //カスタム投稿を追加 function add_custom_post(){ //よくある質問 register_post_type( 'question', array( 'labels' => array( 'name' => 'よくある質問', 'singular_name' => 'よくある質問', ), 'public' => false, 'show_ui' => true, 'menu_position' => 6, 'has_archive' => true, 'hierarchical' => false, 'supports' => array( 'title', 'editor', // 'excerpt', // 'thumbnail', // 'custom-fields', ), ) ); } ?>
大事なのは、
'public' => false
'show_ui' => true
です。