Changeset 26307
- Timestamp:
- 11/21/2013 07:30:35 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/meta.php
r26055 r26307 559 559 560 560 // 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 ); 564 564 565 565 if ( !empty($meta_list) ) { -
trunk/tests/phpunit/tests/meta.php
r25255 r26307 172 172 $this->assertEquals( 2, substr_count( $posts->request, 'CAST(' ) ); 173 173 } 174 175 function test_meta_cache_order_asc() { 176 $post_id = $this->factory->post->create(); 177 $colors = array( 'red', 'blue', 'yellow', 'green' ); 178 foreach ( $colors as $color ) 179 add_post_meta( $post_id, 'color', $color ); 180 181 foreach ( range( 1, 10 ) as $i ) { 182 $meta = get_post_meta( $post_id, 'color' ); 183 $this->assertEquals( $meta, $colors ); 184 185 if ( 0 === $i % 2 ) 186 wp_cache_delete( $post_id, 'post_meta' ); 187 } 188 } 174 189 }
Note: See TracChangeset
for help on using the changeset viewer.