menu_order
Filter HookDescription
Filters the order of administration menu items. A truthy value must first be passed to the {@see 'custom_menu_order'} filter for this filter to work. Use the following to enable custom menu ordering: add_filter( 'custom_menu_order', '__return_true' );Hook Information
File Location |
wp-admin/includes/menu.php
View on GitHub
|
Hook Type | Filter |
Line Number | 306 |
Hook Parameters
Type | Name | Description |
---|---|---|
array
|
$menu_order
|
An ordered array of menu items. |
Usage Examples
Basic Usage
<?php
// Hook into menu_order
add_filter('menu_order', 'my_custom_filter', 10, 1);
function my_custom_filter($menu_order) {
// Your custom filtering logic here
return $menu_order;
}
Source Code Context
wp-admin/includes/menu.php:306
- How this hook is used in WordPress core
<?php
301 *
302 * @since 2.8.0
303 *
304 * @param array $menu_order An ordered array of menu items.
305 */
306 $menu_order = apply_filters( 'menu_order', $menu_order );
307 $menu_order = array_flip( $menu_order );
308
309 $default_menu_order = array_flip( $default_menu_order );
310
311 /**
PHP Documentation
<?php
/**
* Filters the order of administration menu items.
*
* A truthy value must first be passed to the {@see 'custom_menu_order'} filter
* for this filter to work. Use the following to enable custom menu ordering:
*
* add_filter( 'custom_menu_order', '__return_true' );
*
* @since 2.8.0
*
* @param array $menu_order An ordered array of menu items.
*/
Quick Info
- Hook Type: Filter
- Parameters: 1
- File: wp-admin/includes/menu.php
Related Hooks
Related hooks will be displayed here in future updates.