I'm using WordPress 4.9.1 and WooCommerce 3.2.6.

I have added a new Custom Post Type (Subscriptions) and inserted the menu item under the 'WooCommerce' menu in the admin panel using 'show_in_menu' => 'woocommerce', but I want to move my post type immediately under 'Orders'.

enter image description here

I have tried changing menu_position but it doesn't have any effect.

      'labels' => array(
        'name' => __( 'Subscriptions' ),
        'singular_name' => __( 'Subscription' ),
        'add_new_item' => "Add New Subscription",
        'edit_item' => "Edit Subscription",
      'public' => true,
      'has_archive' => false,
      'publicly_queryable'  => false,
      'show_in_rest'       => false,
      'show_in_menu'       => 'woocommerce',
      'menu_position'      => 9999,
      'supports' => array(


I changed show_in_menu to false when registering my post type, and added the following code:

function add_subscriptions_menu() {
    add_submenu_page('woocommerce','Subscriptions','Subscriptions', 'manage_options', 'edit.php?post_type=subscription');

// Change the 30 to customise item's order within WooCommerce submenu.
add_action( 'admin_menu', 'add_subscriptions_menu', 30 );

1 Answer 1


menu_position is not used when you set show_in_menu to a submenu.

to put your menu in last position there is 2 solutions. The first is to change the menu construction priority like this :

add_action("admin_menu", function () {

    remove_action('admin_menu', '_add_post_type_submenus');

    add_action( 'admin_menu', '_add_post_type_submenus', 200);
    // 200 to set it after the last element of WooCommerce which as the priority 70

}, 1);

With this, all custom post types are modified. If this is not what you want, the 2nd solution is to set show_in_menu to FALSE and to create the submenu by yourself with https://developer.wordpress.org/reference/functions/add_submenu_page/

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.