在您的功能中。例如,您可以注册一个新的分类法并与您的自定义帖子类型相关
创建自定义帖子类型:https://codex.wordpress.org/Function_Reference/register_post_type
register_post_type(\'books\',
array(
\'labels\' => array(
\'name\' => __(\'Books\', \'sc\'),
\'singular_name\' => __(\'Book\', \'sc\')
),
\'public\' => true,
\'has_archive\' => true,
\'rewrite\' => array(\'slug\' => \'books\'),
\'supports\' => array(\'title\', \'editor\', \'author\', \'thumbnail\')
)
);
创建自定义分类法(类似于类别)
https://codex.wordpress.org/Function_Reference/register_taxonomyregister_taxonomy(
\'gender\',
\'books\',// your custom post name
array(
\'label\' => __(\'Gender\', \'sc\'),
\'rewrite\' => array( \'slug\' => \'gender\' ),
\'show_ui\' => true,
\'public\' => true,
\'show_in_quick_edit\' => false,
\'meta_box_cb\' => false,
\'show_in_menu\'=>true,
\'show_in_nav_menus\' => true,
\'query_var\' => true,
)
);