WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Plugin API/Filter Reference/menu order

Description

This hook adds the ability for plugins to reorder top-level menus. Attached code demonstrates menus with Dashboard, Posts, and Comments in the first menu group. The remaining menus follow in their usual order. When filtering the order array, any menus that are not mentioned in the array will be sorted after ones that are mentioned. Unmentioned menus are sorted in their usual order, relative to other unmentioned menus.

Examples

function custom_menu_order() {
	return array( 'index.php', 'edit.php', 'edit-comments.php' );
}

add_filter( 'custom_menu_order', '__return_true' );
add_filter( 'menu_order', 'custom_menu_order' );

Return to Plugin API/Filter Reference