array( 'name' => __('Banners', 'aksrt'), 'singular_name' => __('Banner', 'aksrt'), ), 'public' => false, 'show_ui' => false, 'show_in_rest' => true, 'supports' => array('title'), 'menu_icon' => 'dashicons-images-alt2', 'capability_type' => 'post', 'capabilities' => array('create_posts' => 'manage_options'), 'map_meta_cap' => true, )); } add_action('init', 'aksrt_register_banner_cpt'); // ============================================================ // §3.7 Register Topics taxonomy for posts (专题分类) // ============================================================ function aksrt_register_topics_taxonomy() { register_taxonomy('topics', 'post', [ 'labels' => [ 'name' => __('专题', 'aksrt'), 'singular_name' => __('专题', 'aksrt'), 'search_items' => __('搜索专题', 'aksrt'), 'all_items' => __('所有专题', 'aksrt'), 'edit_item' => __('编辑专题', 'aksrt'), 'add_new_item' => __('添加专题', 'aksrt'), 'menu_name' => __('专题', 'aksrt'), ], 'hierarchical' => true, 'public' => true, 'show_in_rest' => true, 'show_admin_column' => true, 'rewrite' => ['slug' => 'topics'], ]); } add_action('init', 'aksrt_register_topics_taxonomy'); // ============================================================