WordPress.org

Make WordPress Core

Ticket #16856: menu.php.int.diff

File menu.php.int.diff, 837 bytes (added by nathanrice, 4 years ago)

Use isset() instead of is_int() when setting the $menu position for custom post types. Cast position as (int).

  • wp-admin/menu.php

     
    123123 
    124124foreach ( (array) get_post_types( array('show_ui' => true, '_builtin' => false) ) as $ptype ) { 
    125125        $ptype_obj = get_post_type_object( $ptype ); 
    126         $ptype_menu_position = is_int( $ptype_obj->menu_position ) ? $ptype_obj->menu_position : $_wp_last_object_menu++; // If we're to use $_wp_last_object_menu, increment it first. 
     126        $ptype_menu_position = isset( $ptype_obj->menu_position ) ? $ptype_obj->menu_position : $_wp_last_object_menu++; // If we're to use $_wp_last_object_menu, increment it first. 
    127127        $ptype_for_id = sanitize_html_class( $ptype ); 
    128128        if ( is_string( $ptype_obj->menu_icon ) ) { 
    129129                $menu_icon   = esc_url( $ptype_obj->menu_icon );