Change position of a Custom Post Type menu item within a plugin admin menu? (1 post)

  1. AThomas92
    Posted 2 years ago #


    I'm writing my first plugin (my first proper one anyway) and I've created a custom post type called programs. I've managed to get the custom post type menu item nested with the plugin admin menu, but I can only get it to display as the first item, which isn't how I'd like it.

    So at the moment the menu is rendering like this:

    • My Plugin
      • Programmes
      • Dashboard
      • Applications

    Whereas I'd like it to look like this:

    • My Plugin
      • Dashboard
      • Programmes
      • Applications

    Here are my arguments for the custom post type:

    $args = array(
        'label'               => __( 'programmes', 'MyPlugin' ),
        'description'         => __( 'Programmes for application from partner organisations', 'MyPlugin' ),
        'labels'              => $labels,
        'supports'            => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'revisions', 'custom-fields', ),
        'taxonomies'          => array( 'programmes_categories' ),
        'hierarchical'        => true,
        'public'              => true,
        'show_ui'             => true,
        'show_in_menu'        => 'MyPlugin',
        'show_in_nav_menus'   => false,
        'show_in_admin_bar'   => false,
        'menu_position'       => 2,
        'can_export'          => true,
        'has_archive'         => true,
        'exclude_from_search' => true,
        'publicly_queryable'  => false,
        'capability_type'     => 'post'

    Any ideas?

    Thanks in advance,


Topic Closed

This topic has been closed to new replies.

About this Topic