我正在创建自己的自定义帖子类型,下面是代码:
add_action( \'init\', \'create_gallery_post_type\' );
function create_gallery_post_type() {
register_post_type( \'gallery\',
array(
\'labels\' => array(
\'name\' => __( \'Galleries\' ),
\'singular_name\' => __( \'Gallery\' )
),
\'publicly_queryable\' => true,
\'show_ui\' => true,
\'query_var\' => true,
\'rewrite\' => true,
\'capability_type\' => \'post\',
\'hierarchical\' => false,
\'menu_position\' => null,
\'taxonomies\' => array(\'category\'),
\'supports\' => array(\'title\',\'editor\',\'thumbnail\')
)
);
}
我有另一个自定义帖子类型,它有自己的自定义类别分类法,叫做“公文包类别”。我想对这个帖子类型使用相同的分类法,因为它们是相同的值,我只需要在一个地方输入它们。
我试着让它说:
\'taxonomies\' => array(\'portfolio-category\')
但这并没有显示我的图库帖子类型下的类别链接。有什么想法吗?谢谢