I want to add a subitem to “Woocommerce” parent item, below “Orders”, this subitem is a custom post type.
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.
Any idea?!
Short answer, use:
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:You need a high(er) priority number to execute it later then the
woocommerce_admin_menu
function, which has 9, and there iswoocommerce_admin_menu_after
, which has 50 – those functionbs are inwoocommerce-admin-init.php
.