apply_filters( ‘menu_order’, array $menu_order )

Filters the order of administration menu items.

Description

A truthy value must first be passed to the ‘custom_menu_order’ filter for this filter to work. Use the following to enable custom menu ordering:

add_filter( 'custom_menu_order', '__return_true' );

Parameters

$menu_orderarray
An ordered array of menu items.

More Information

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.

Source

$menu_order = apply_filters( 'menu_order', $menu_order );

Changelog

VersionDescription
2.8.0Introduced.

User Contributed Notes

  1. Skip to note 2 content

    Example Migrated from Codex:

    The example below orders menus with Dashboard, Posts, and Comments in the first menu group. The remaining menus follow in their usual order.

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

You must log in before being able to contribute a note or feedback.