Changeset 4419 for trunk/wp-includes/functions.php
- Timestamp:
- 10/24/2006 10:52:59 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/functions.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/functions.php
r4383 r4419 564 564 update_post_category_cache($post_id_list); 565 565 566 update_postmeta_cache($post_id_list); 567 } 568 569 function update_postmeta_cache($post_id_list = '') { 570 global $wpdb, $post_meta_cache; 571 572 // We should validate this comma-separated list for the upcoming SQL query 573 $post_id_list = preg_replace('|[^0-9,]|', '', $post_id_list); 574 575 // we're marking each post as having its meta cached (with no keys... empty array), to prevent posts with no meta keys from being queried again 576 // any posts that DO have keys will have this empty array overwritten with a proper array, down below 577 $post_id_array = explode(',', $post_id_list); 578 foreach ( (array) $post_id_array as $pid ) 579 $post_meta_cache[$pid] = array(); 580 566 581 // Get post-meta info 567 582 if ( $meta_list = $wpdb->get_results("SELECT post_id, meta_key, meta_value FROM $wpdb->postmeta WHERE post_id IN($post_id_list) ORDER BY post_id, meta_key", ARRAY_A) ) { 568 583 // Change from flat structure to hierarchical: 569 $post_meta_cache = array(); 584 if ( !isset($post_meta_cache) ) 585 $post_meta_cache = array(); 586 570 587 foreach ($meta_list as $metarow) { 571 588 $mpid = (int) $metarow['post_id'];
Note: See TracChangeset
for help on using the changeset viewer.