These are the args I used to get "Artists" display above "Master Artist Lookup" using the "menu_position" parameter. However , still does not display in menu correctly
$args = [
'label' => __('Artists', SMF_CORE_NAME),
'labels' => [
'name' => __('Artists', SMF_CORE_NAME),
'singular_name' => __('Artist'),
'add_new_item' => __('Add New Artist', SMF_CORE_NAME),
'add_new' => __('Add New Artist', SMF_CORE_NAME),
'new_item' => __('Add New Artist', SMF_CORE_NAME),
'all_items' => __('All Artists', SMF_CORE_NAME),
'edit_item' => __('Edit Artist', SMF_CORE_NAME)
],
'supports' => ['title', 'thumbnail'],
'hierarchical' => false,
'public' => true,
'menu_icon' => 'dashicons-format-audio',
'can_export' => true,
'has_archive' => false,
'publicly_queryable' => false,
'menu_position' => '20.1',
];
$args = [
'label' => __('Master Artist Lookup', SMF_CORE_NAME),
'labels' => [
'name' => __('Master Artist Lookup', SMF_CORE_NAME),
'singular_name' => __('Master Artist Lookup'),
'add_new_item' => __('Add New Artist', SMF_CORE_NAME),
'add_new' => __('Add New Artist', SMF_CORE_NAME),
'new_item' => __('Add New Artist', SMF_CORE_NAME),
'all_items' => __('All Artists', SMF_CORE_NAME),
'edit_item' => __('Edit Artist', SMF_CORE_NAME)
],
'supports' => ['title', 'thumbnail'],
'hierarchical' => false,
'public' => true,
'menu_icon' => 'dashicons-format-audio',
'can_export' => true,
'has_archive' => false,
'publicly_queryable' => false,
'menu_position' => '20.2',
];
These are the args I used to get "Artists" display above "Master Artist Lookup" using the "menu_position" parameter. However , still does not display in menu correctly
$args = [
'label' => __('Artists', SMF_CORE_NAME),
'labels' => [
'name' => __('Artists', SMF_CORE_NAME),
'singular_name' => __('Artist'),
'add_new_item' => __('Add New Artist', SMF_CORE_NAME),
'add_new' => __('Add New Artist', SMF_CORE_NAME),
'new_item' => __('Add New Artist', SMF_CORE_NAME),
'all_items' => __('All Artists', SMF_CORE_NAME),
'edit_item' => __('Edit Artist', SMF_CORE_NAME)
],
'supports' => ['title', 'thumbnail'],
'hierarchical' => false,
'public' => true,
'menu_icon' => 'dashicons-format-audio',
'can_export' => true,
'has_archive' => false,
'publicly_queryable' => false,
'menu_position' => '20.1',
];
$args = [
'label' => __('Master Artist Lookup', SMF_CORE_NAME),
'labels' => [
'name' => __('Master Artist Lookup', SMF_CORE_NAME),
'singular_name' => __('Master Artist Lookup'),
'add_new_item' => __('Add New Artist', SMF_CORE_NAME),
'add_new' => __('Add New Artist', SMF_CORE_NAME),
'new_item' => __('Add New Artist', SMF_CORE_NAME),
'all_items' => __('All Artists', SMF_CORE_NAME),
'edit_item' => __('Edit Artist', SMF_CORE_NAME)
],
'supports' => ['title', 'thumbnail'],
'hierarchical' => false,
'public' => true,
'menu_icon' => 'dashicons-format-audio',
'can_export' => true,
'has_archive' => false,
'publicly_queryable' => false,
'menu_position' => '20.2',
];
There are two ways to affect where CPTs appear in the admin menu: using menu_position
and controlling when the CPTs are registered.
Using decimal numbers hasn't been reliable in my experience; using an integer like 21
, 22
, etc. has been more effective. If you have so many CPTs there aren't enough integers, the other trick is to register the one you want first first, then register the second, then register the third. By controlling the code order, and keeping the menu_position
the same for all of them, WP will put them in the order you register them in.