Changeset 36524 for trunk/src/wp-includes/query.php
- Timestamp:
- 02/13/2016 03:04:05 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/query.php
r36484 r36524 1303 1303 */ 1304 1304 public $thumbnails_cached = false; 1305 1306 /**1307 * Whether the term meta cache for matched posts has been primed.1308 *1309 * @since 4.4.01310 * @access protected1311 * @var bool1312 */1313 public $updated_term_meta_cache = false;1314 1315 /**1316 * Whether the comment meta cache for matched posts has been primed.1317 *1318 * @since 4.4.01319 * @access protected1320 * @var bool1321 */1322 public $updated_comment_meta_cache = false;1323 1305 1324 1306 /** … … 4875 4857 */ 4876 4858 public function lazyload_term_meta( $check, $term_id ) { 4877 /*4878 * We only do this once per `WP_Query` instance.4879 * Can't use `remove_filter()` because of non-unique object hashes.4880 */4881 if ( $this->updated_term_meta_cache ) {4882 return $check;4883 }4884 4885 4859 // We can only lazyload if the entire post object is present. 4886 4860 $posts = array(); … … 4916 4890 if ( isset( $term_ids[ $term_id ] ) ) { 4917 4891 update_termmeta_cache( array_keys( $term_ids ) ); 4918 $this->updated_term_meta_cache = true;4892 remove_filter( 'get_term_metadata', array( $this, 'lazyload_term_meta' ), 10, 2 ); 4919 4893 } 4920 4894 } … … 4922 4896 // If no terms were found, there's no need to run this again. 4923 4897 if ( empty( $term_ids ) ) { 4924 $this->updated_term_meta_cache = true;4898 remove_filter( 'get_term_metadata', array( $this, 'lazyload_term_meta' ), 10, 2 ); 4925 4899 } 4926 4900 … … 4941 4915 */ 4942 4916 public function lazyload_comment_meta( $check, $comment_id ) { 4943 /*4944 * We only do this once per `WP_Query` instance.4945 * Can't use `remove_filter()` because of non-unique object hashes.4946 */4947 if ( $this->updated_comment_meta_cache ) {4948 return $check;4949 }4950 4951 4917 // Don't use `wp_list_pluck()` to avoid by-reference manipulation. 4952 4918 $comment_ids = array(); … … 4964 4930 if ( in_array( $comment_id, $comment_ids ) ) { 4965 4931 update_meta_cache( 'comment', $comment_ids ); 4966 $this->updated_comment_meta_cache = true;4932 remove_filter( 'get_comment_metadata', array( $this, 'lazyload_comment_meta' ), 10, 2 ); 4967 4933 } elseif ( empty( $comment_ids ) ) { 4968 $this->updated_comment_meta_cache = true;4934 remove_filter( 'get_comment_metadata', array( $this, 'lazyload_comment_meta' ), 10, 2 ); 4969 4935 } 4970 4936
Note: See TracChangeset
for help on using the changeset viewer.