カスタム投稿タイプ一覧ページが表示されない時の対処法
'has_archive'を見直す
'has_archive'
が falseになっていたのが原因でした。
add_action( 'init', 'register_my_post_types' );
function register_my_post_types() {
register_post_type( 'news', array(
'labels' => array(
'name' => __( 'お知らせ' ),
'singular_name' => __( 'お知らせ' ),
),
'public' => true,
'has_archive' => true, // ← ここを true
'menu_position'=> 5,
'supports' => array( 'title', 'editor', 'thumbnail' ),
'show_in_rest' => true,
) );
}