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. Built from https://develop.svn.wordpress.org/trunk@26307 git-svn-id: http://core.svn.wordpress.org/trunk@26211 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
1aa122be5e
commit
05b22769e9
|
@ -558,9 +558,9 @@ function update_meta_cache($meta_type, $object_ids) {
|
|||
return $cache;
|
||||
|
||||
// Get meta info
|
||||
$id_list = join(',', $ids);
|
||||
$meta_list = $wpdb->get_results( $wpdb->prepare("SELECT $column, meta_key, meta_value FROM $table WHERE $column IN ($id_list)",
|
||||
$meta_type), ARRAY_A );
|
||||
$id_list = join( ',', $ids );
|
||||
$id_column = 'user' == $meta_type ? 'umeta_id' : 'meta_id';
|
||||
$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 );
|
||||
|
||||
if ( !empty($meta_list) ) {
|
||||
foreach ( $meta_list as $metarow) {
|
||||
|
|
Loading…
Reference in New Issue