我有一个自定义的帖子类型,叫做预测。代码如下:
<?php
// Register forecasts cpt
function forecasts() {
$labels = array(
\'name\' => _x( \'Forecasts\', \'Post Type General Name\', \'reedbc\' ),
\'singular_name\' => _x( \'Forecast\', \'Post Type Singular Name\', \'reedbc\' ),
\'menu_name\' => __( \'Forecasts\', \'reedbc\' ),
\'name_admin_bar\' => __( \'Forecasts\', \'reedbc\' ),
\'archives\' => __( \'Item Archives\', \'reedbc\' ),
\'attributes\' => __( \'Item Attributes\', \'reedbc\' ),
\'parent_item_colon\' => __( \'Parent Item:\', \'reedbc\' ),
\'all_items\' => __( \'All Items\', \'reedbc\' ),
\'add_new_item\' => __( \'Add New Item\', \'reedbc\' ),
\'add_new\' => __( \'Add New\', \'reedbc\' ),
\'new_item\' => __( \'New Item\', \'reedbc\' ),
\'edit_item\' => __( \'Edit Item\', \'reedbc\' ),
\'update_item\' => __( \'Update Item\', \'reedbc\' ),
\'view_item\' => __( \'View Item\', \'reedbc\' ),
\'view_items\' => __( \'View Items\', \'reedbc\' ),
\'search_items\' => __( \'Search Item\', \'reedbc\' ),
\'not_found\' => __( \'Not found\', \'reedbc\' ),
\'not_found_in_trash\' => __( \'Not found in Trash\', \'reedbc\' ),
\'featured_image\' => __( \'Featured Image\', \'reedbc\' ),
\'set_featured_image\' => __( \'Set featured image\', \'reedbc\' ),
\'remove_featured_image\' => __( \'Remove featured image\', \'reedbc\' ),
\'use_featured_image\' => __( \'Use as featured image\', \'reedbc\' ),
\'insert_into_item\' => __( \'Insert into item\', \'reedbc\' ),
\'uploaded_to_this_item\' => __( \'Uploaded to this item\', \'reedbc\' ),
\'items_list\' => __( \'Items list\', \'reedbc\' ),
\'items_list_navigation\' => __( \'Items list navigation\', \'reedbc\' ),
\'filter_items_list\' => __( \'Filter items list\', \'reedbc\' ),
);
$args = array(
\'label\' => __( \'Forecasts\', \'reedbc\' ),
\'description\' => __( \'A custom post type for forecasts.\', \'reedbc\' ),
\'labels\' => $labels,
\'supports\' => array( \'title\', \'editor\', \'thumbnail\', \'excerpt\' ),
\'taxonomies\' => array( \'category\', \'post_tag\' ),
\'hierarchical\' => false,
\'public\' => true,
\'show_ui\' => true,
\'show_in_menu\' => true,
\'menu_position\' => 5,
\'show_in_admin_bar\' => true,
\'show_in_nav_menus\' => true,
\'can_export\' => true,
\'has_archive\' => false,
\'exclude_from_search\' => false,
\'publicly_queryable\' => true,
\'capability_type\' => \'page\',
\'menu-icon\' => \'dashicons-cloud\',
\'show_in_rest\' => true,
);
register_post_type( \'forecasts\', $args );
}
add_action( \'init\', \'forecasts\', 0 );
我尝试添加以下菜单图标,如下所示
\'menu-icon\' => \'dashicons-cloud\'
.
WP Admin仍显示默认pin图标。我试着清理我的永久链接,但这不起作用。
有什么想法吗?