bonsai's blog

ITベンチャー所属。Webエンジニア兼マーケッターです。python習得しようと頑張ってるごく一般的なサラリーマン。※ブログ初心者の為、至らぬ所は..m(_ _)m

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
です。