In the Settings menu, I have the following menu items listed:
Settings
-- General
-- Writing
-- Reading
-- Discussion
-- Media
-- Permalinks
-- Blogging
I’d like to the Blogging (options-general.php?page=blogging
) reordered underneath General instead of being at the bottom. This was added with the add_options_page()
function.
From doing some research, this is what I’ve come up with:
add_filter( 'custom_menu_order', array( $this, 'submenu_order' ) );
function submenu_order( $menu_order ) {
global $submenu;
$order = array();
$order[] = $submenu['options-general.php'][10];
$order[] = $submenu['options-general.php'][41];
$submenu['options-general.php'] = $order;
return $menu_order;
}
This works, but it only shows General and Blogging, the rest are removed:
Settings
-- General
-- Blogging
Also, $submenu['options-general.php'][41]
is currently index position 41
for me. Does this mean it will be the same index position for everyone else even if they have another plugin settings listed?