WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to add a subitem to "Woocommerce" parent item, below "Orders", this subitem is a custom post type.

enter image description here

I tried to use (in $args):

$args = array('show_in_menu' => 'edit.php?post_type=shop_order');
register_post_type('my_posttype', $args);

But it doesn't work, I tried with another section ex. 'edit.php?anotherpage' and it works.

enter image description here

Any idea?!

share|improve this question
up vote 3 down vote accepted

Short answer, use:

$args = array('show_in_menu' => 'woocommerce');
register_post_type('my_posttype', $args);

But this won't give you the custom post type submenus.

You can also use add_submenu_page, the code below is just an example:

function register_my_custom_submenu_page() {
    add_submenu_page( 'woocommerce', 'My Custom Submenu Page', 'My Custom Submenu Page', 'manage_options', 'my-custom-submenu-page', 'my_custom_submenu_page_callback' ); 
function my_custom_submenu_page_callback() {
    echo '<h3>My Custom Submenu Page</h3>';
add_action('admin_menu', 'register_my_custom_submenu_page',99);

You need a high(er) priority number to execute it later then the woocommerce_admin_menu function, which has 9, and there is woocommerce_admin_menu_after, which has 50 - those functionbs are in woocommerce-admin-init.php.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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