admin管理员组文章数量:1419666
In wordpress 5.22 , After creating a custom post type like:
function create_products_cpt(){
register_post_type( 'product',
array(
'labels' => $labels,
'public' => true,
'supports' => array(
'title',
'editor',
'thumbnail',
'custom-fields'
),
'taxonomies'=>['product-category'],
'register_meta_box_cb' => 'register_metaboxes',
'show_in_rest' => true
)
);
register_taxonomy('product-category','product',array(
'hierarchical'=>true,
'label'=>'product categories'
));
}
add_action( 'init', 'create_products_cpt' );
I am able to create post types and categories inside the taxonomy from the dashboard, but it is impossible to mark a specific post of that post type as belonging to any of the categories, since the selector just doesn't appear. I double-checked on an older version of wordpress (4.89) and it does work as intended, selector and all. What could be the issue here?
In wordpress 5.22 , After creating a custom post type like:
function create_products_cpt(){
register_post_type( 'product',
array(
'labels' => $labels,
'public' => true,
'supports' => array(
'title',
'editor',
'thumbnail',
'custom-fields'
),
'taxonomies'=>['product-category'],
'register_meta_box_cb' => 'register_metaboxes',
'show_in_rest' => true
)
);
register_taxonomy('product-category','product',array(
'hierarchical'=>true,
'label'=>'product categories'
));
}
add_action( 'init', 'create_products_cpt' );
I am able to create post types and categories inside the taxonomy from the dashboard, but it is impossible to mark a specific post of that post type as belonging to any of the categories, since the selector just doesn't appear. I double-checked on an older version of wordpress (4.89) and it does work as intended, selector and all. What could be the issue here?
Share Improve this question asked Jul 25, 2019 at 0:14 SessionCookieMonsterSessionCookieMonster 132 bronze badges1 Answer
Reset to default 0I've pasted your code in Twenty Nineteen and it works as expected with Classic Editor ( and I'm sure it will work pre-Block Editor also ). Your taxonomy will not show up in the Block Editor unless you specify to display that taxonomy in rest as you've done with your post type:
register_taxonomy( 'product-category', 'product', array(
'hierarchical'=>true,
'label'=>'product categories',
'show_in_rest' => true
) );
Once you enable REST it will become available in the Block Editor.
本文标签: Taxonomies don39t show up on in the dashboard page for a custom post type in wordpress 522
版权声明:本文标题:Taxonomies don't show up on in the dashboard page for a custom post type in wordpress 5.22 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745297873a2652188.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论