Make WordPress Core


Ignore:
Timestamp:
03/19/2015 03:55:39 AM (10 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/ms.php

    r31517 r31829  
    805805            <?php
    806806            if ( !$found ) {
    807                 $blog = array_shift( $all_blogs );
     807                $blog = reset( $all_blogs );
    808808                update_user_meta( get_current_user_id(), 'primary_blog', $blog->userblog_id );
    809809            }
    810810        } elseif ( count( $all_blogs ) == 1 ) {
    811             $blog = array_shift( $all_blogs );
     811            $blog = reset( $all_blogs );
    812812            echo $blog->domain;
    813813            if ( $primary_blog != $blog->userblog_id ) // Set the primary blog again if it's out of sync with blog list.
Note: See TracChangeset for help on using the changeset viewer.