Search code examples
phpwordpressdashicons

Dashicons not showing in Wordpress 4.9.1?


So I'm attempting a little customisation of the admin dashboard in Wordpress (version 4.9.1 bleeding edge). I'm creating a custom post within a plugin that I will be developing for bidding and displaying ad listing posts. The register_post_type function setup is fairly standard and as follows (stripping away anything surplus to requirements):

function tp_register_advert_post_type() {

  $singular = 'Ad Listing';
  $plural = 'Ad Listings';

  $labels = array(
    'name' => $plural,
    'singular_name'       => $singular,
    'add_name'            => 'Add New',
    'add_new_item'        => 'Add New ' . $singular,
    'edit'                => 'Edit',
    'edit_item'           => 'Edit ' . $singular,
    'new_item'            => 'New ' . $singular,
    'view'                => 'View',
    'view_item'           => 'View ' . $singular,
    'search_item'         => 'Search ' . $plural,
    'parent'              => 'Parent ' . $singular,
    'not_found'           => 'No ' . $plural .' found',
    'not_found_in_trash'  => 'No ' . $plural .' in Trash'
  );

  $args = array(
    'labels'              => $labels,
    'capability_type'     => 'post',
    'public'              => true,
    'publicly_queryable'  => true,
    'has_archive'         => true,
    'exclude_from_search' => false,
    'show_ui'             => true,
    'show_in_menu'        => true,
    'show_in_admin_bar'   => true,
    'menu_position'       => 6,
    'menu-icon'           => 'dashicons-vault',
    'can_export'          => true,
  );

  register_post_type( 'ad listing', $args );
}
add_action( 'init', 'tp_register_advert_post_type' );

Everything works except the menu_icon in the $args array? What exactly have I done wrong here? I can't see anything obvious - everything else works, other than the default "pin" icon is still showing? Help?


Solution

  • It appears that your index in $args is menu-icon but it should be menu_icon according to the Codex.