1

I have a custom post type called forecasts. Here's the code:

<?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 );

I've tried adding the following menu icon, like so 'menu-icon' => 'dashicons-cloud'.

WP Admin still shows the default pin icon. I've tried clearing my permalinks, but this doesn't work.

Any ideas?

1 Answer 1

2

You have a typo. It is supposed to be menu_icon not menu-icon.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.