I’m creating a plugin which generates a handfull or custom post types (CPT). I’ve create a top level menu in the admin left sidebar using add_menu_page()
. I then added all CPTs to this menu using register_post_type()
‘s show_in_menu
option. I also created a plugin settings page using add_submenu_page()
, which I also added to the top menu.
My problem is that I can’t get the settings page to appear above the CPT pages in the submenu. I make the register_post_type()
call in an “init” action, and I make the add_submenu_page()
call in a “admin_menu” action (which happens after “init”). So, it makes sense that the CPT pages come first. I can’t move the register_post_type()
calls to later in the process (it’s too late to register a CPT, and I can’t move the add_submenu_page()
earlier (it’s not defined earlier).
Do I just have to live with it?
you can use the
menu_order
filter hook to change the order