Changeset 56925 for trunk/src/wp-includes/post.php
- Timestamp:
- 10/12/2023 11:39:05 PM (15 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/src/wp-includes/post.php ¶
r56819 r56925 7271 7271 7272 7272 wp_cache_delete( $post->ID, 'posts' ); 7273 wp_cache_delete( 'post_parent:' . (string) $post->ID, 'posts' ); 7273 7274 wp_cache_delete( $post->ID, 'post_meta' ); 7274 wp_cache_delete( $post->ID, 'post_parent' );7275 7275 7276 7276 clean_object_term_cache( $post->ID, $post->post_type ); … … 7818 7818 global $wpdb; 7819 7819 7820 $non_cached_ids = _get_non_cached_ids( $ids, 'post_parent' ); 7820 $ids = array_filter( $ids, '_validate_cache_id' ); 7821 $ids = array_unique( array_map( 'intval', $ids ), SORT_NUMERIC ); 7822 7823 if ( empty( $ids ) ) { 7824 return; 7825 } 7826 7827 $cache_keys = array(); 7828 foreach ( $ids as $id ) { 7829 $cache_keys[ $id ] = 'post_parent:' . (string) $id; 7830 } 7831 7832 $cached_data = wp_cache_get_multiple( array_values( $cache_keys ), 'posts' ); 7833 7834 $non_cached_ids = array(); 7835 foreach ( $cache_keys as $id => $cache_key ) { 7836 if ( false === $cached_data[ $cache_key ] ) { 7837 $non_cached_ids[] = $id; 7838 } 7839 } 7840 7821 7841 if ( ! empty( $non_cached_ids ) ) { 7822 7842 $fresh_posts = $wpdb->get_results( sprintf( "SELECT $wpdb->posts.ID, $wpdb->posts.post_parent FROM $wpdb->posts WHERE ID IN (%s)", implode( ',', $non_cached_ids ) ) ); … … 7825 7845 $post_parent_data = array(); 7826 7846 foreach ( $fresh_posts as $fresh_post ) { 7827 $post_parent_data[ (int) $fresh_post->ID ] = (int) $fresh_post->post_parent;7847 $post_parent_data[ 'post_parent:' . (string) $fresh_post->ID ] = (int) $fresh_post->post_parent; 7828 7848 } 7829 7849 7830 wp_cache_add_multiple( $post_parent_data, 'post _parent' );7850 wp_cache_add_multiple( $post_parent_data, 'posts' ); 7831 7851 } 7832 7852 }
Note: See TracChangeset
for help on using the changeset viewer.