menu_order WordPress Filter Hook

The menu_order hook allows you to change the order in which your menu items are displayed. This can be useful if you want to change the order of your pages or if you want to change the order of your posts.

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' );

Top ↑

Parameters

$menu_order

(array)An ordered array of menu items.


Top ↑

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.


Top ↑

Source

File: wp-admin/includes/menu.php

View on Trac


Top ↑

Changelog

Changelog
VersionDescription
2.8.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.