WordPress.org

Make WordPress Core


Ignore:
Timestamp:
03/19/2015 03:55:39 AM (6 years ago)
Author:
wonderboymusic
Message:

Replace array_shift() with reset() where appropriate for performance.

Props SergeyBiryukov.
Fixes #31259.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/ajax-actions.php

    r31811 r31829  
    10921092
    10931093            $_menu_items = array_map( 'wp_setup_nav_menu_item', array( $_object ) );
    1094             $_menu_item = array_shift( $_menu_items );
     1094            $_menu_item = reset( $_menu_items );
    10951095
    10961096            // Restore the missing menu item properties
     
    17941794            wp_die( $error );
    17951795
    1796         $_POST['widget-' . $id_base] = array( $multi_number => array_shift($settings) );
     1796        $_POST[ 'widget-' . $id_base ] = array( $multi_number => reset( $settings ) );
    17971797        $widget_id = $id_base . '-' . $multi_number;
    17981798        $sidebar[] = $widget_id;
Note: See TracChangeset for help on using the changeset viewer.