Make WordPress Core


Ignore:
Timestamp:
11/21/2013 07:30:35 PM (10 years ago)
Author:
wonderboymusic
Message:

In update_meta_cache(), ensure that meta is always stored in the same order. Removes an unnecessary $wpdb->prepare statement. Adds unit test.

Props mattheu.
Fixes #25511.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/meta.php

    r26055 r26307  
    559559
    560560    // Get meta info
    561     $id_list = join(',', $ids);
    562     $meta_list = $wpdb->get_results( $wpdb->prepare("SELECT $column, meta_key, meta_value FROM $table WHERE $column IN ($id_list)",
    563         $meta_type), ARRAY_A );
     561    $id_list = join( ',', $ids );
     562    $id_column = 'user' == $meta_type ? 'umeta_id' : 'meta_id';
     563    $meta_list = $wpdb->get_results( "SELECT $column, meta_key, meta_value FROM $table WHERE $column IN ($id_list) ORDER BY $id_column ASC", ARRAY_A );
    564564
    565565    if ( !empty($meta_list) ) {
Note: See TracChangeset for help on using the changeset viewer.