0340Trackback(774)
2019/03/26(火) 19:21:28.02ID:GnPhJ6H5↓の様なコードをfunctions.phpに記入してます。
function add_custom_post1() {
register_post_type(
'custom1',
array(
'label' => 'カスタム投稿',
'public' => true,
'has_archive' => true,
'menu_position' => 5,
'supports' => array(
'title',
'editor',
'thumbnail',
'revisions',
'excerpt',
'custom-fields',
)
)
);
//カテゴリを投稿と一緒にする
register_taxonomy_for_object_type('category', 'custom1');
//タグを投稿と一緒にする
register_taxonomy_for_object_type('post_tag', 'custom1');
}
add_action('init', 'add_custom_post1');
カテゴリーやタグはちゃんと表示されるのですが、タグで絞り込み?や検索をすると、何故かカスタム投稿タイプの記事が表示されず、記事がありませんと表示されます。
上記のコードでおかしな点があれば、ご指摘お願いいたします