Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #51697, comment 5


Ignore:
Timestamp:
11/03/2020 01:15:26 AM (5 years ago)
Author:
jrf
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #51697, comment 5

    initial v1  
    22
    33This is not necessarily an issue with WP Core, but more likely an issue with a plugin or theme ''doing it wrong''.
     4
     5Relevant code in `wp-admin/includes/menu.php`:
     6{{{#!php
     7<?php
     8        $menu_order = array();
     9        foreach ( $menu as $menu_item ) {
     10                $menu_order[] = $menu_item[2];
     11        }
     12        unset( $menu_item );
     13        $default_menu_order = $menu_order;
     14
     15        $menu_order         = apply_filters( 'menu_order', $menu_order );
     16        $menu_order         = array_flip( $menu_order );
     17        $default_menu_order = array_flip( $default_menu_order );
     18}}}
     19
    420
    521`$menu_order` is an array and get pulled through the `menu_order` filter just before the `array_flip()`, so one of the functions filtering the variable will have broken things by either not returning anything or by returning `null`.