Filter hook 'custom_menu_order'

in WP Core File wp-admin/includes/menu.php at line 284

View Source

custom_menu_order

Filter Hook
Description
Filters whether to enable custom ordering of the administration menu. See the {@see 'menu_order'} filter for reordering menu items.

Hook Information

File Location wp-admin/includes/menu.php View on GitHub
Hook Type Filter
Line Number 284

Hook Parameters

Type Name Description
bool $custom Whether custom ordering is enabled. Default false.

Usage Examples

Basic Usage
<?php
// Hook into custom_menu_order
add_filter('custom_menu_order', 'my_custom_filter', 10, 1);

function my_custom_filter($custom) {
    // Your custom filtering logic here
    return $custom;
}

Source Code Context

wp-admin/includes/menu.php:284 - How this hook is used in WordPress core
<?php
 279   *
 280   * @since 2.8.0
 281   *
 282   * @param bool $custom Whether custom ordering is enabled. Default false.
 283   */
 284  if ( apply_filters( 'custom_menu_order', false ) ) {
 285  	$menu_order = array();
 286  
 287  	foreach ( $menu as $menu_item ) {
 288  		$menu_order[] = $menu_item[2];
 289  	}

PHP Documentation

<?php
/**
 * Filters whether to enable custom ordering of the administration menu.
 *
 * See the {@see 'menu_order'} filter for reordering menu items.
 *
 * @since 2.8.0
 *
 * @param bool $custom Whether custom ordering is enabled. Default false.
 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-admin/includes/menu.php
Related Hooks

Related hooks will be displayed here in future updates.