Ticket #34047: 34047.3.diff
File 34047.3.diff, 2.5 KB (added by , 10 years ago) |
---|
-
src/wp-includes/query.php
3561 3561 3562 3562 3563 3563 if ( $q['update_post_term_cache'] ) { 3564 add_ action( 'get_term_metadata', array( $this, 'lazyload_term_meta' ), 10, 2 );3564 add_filter( 'get_term_metadata', array( $this, 'lazyload_term_meta' ), 10, 2 ); 3565 3565 } 3566 3566 3567 3567 if ( ! $q['suppress_filters'] ) { … … 3693 3693 3694 3694 // If comments have been fetched as part of the query, make sure comment meta lazy-loading is set up. 3695 3695 if ( ! empty( $this->comments ) ) { 3696 add_ action( 'get_comment_metadata', array( $this, 'lazyload_comment_meta' ), 10, 2 );3696 add_filter( 'get_comment_metadata', array( $this, 'lazyload_comment_meta' ), 10, 2 ); 3697 3697 } 3698 3698 3699 3699 if ( ! $q['suppress_filters'] ) { … … 4768 4768 * @since 4.4.0 4769 4769 * @access public 4770 4770 * 4771 * @param null $check The `$check` param passed from the 'pre_term_metadata' hook.4771 * @param mixed $check The `$check` param passed from the 'get_term_metadata' hook. 4772 4772 * @param int $term_id ID of the term whose metadata is being cached. 4773 4773 * @return mixed In order not to short-circuit `get_metadata()`. Generally, this is `null`, but it could be 4774 4774 * another value if filtered by a plugin. … … 4776 4776 public function lazyload_term_meta( $check, $term_id ) { 4777 4777 /* 4778 4778 * We only do this once per `WP_Query` instance. 4779 * Can't use `remove_ action()` because of non-unique object hashes.4779 * Can't use `remove_filter()` because of non-unique object hashes. 4780 4780 */ 4781 4781 if ( $this->updated_term_meta_cache ) { 4782 4782 return $check; … … 4839 4839 * 4840 4840 * @since 4.4.0 4841 4841 * 4842 * @param null $check The `$check` param passed from the 'pre_comment_metadata' hook.4842 * @param mixed $check The `$check` param passed from the 'get_comment_metadata' hook. 4843 4843 * @param int $comment_id ID of the comment whose metadata is being cached. 4844 * @return null In order not to short-circuit `get_metadata()`.4844 * @return mixed The original value of `$check`, to not affect 'get_comment_metadata'. 4845 4845 */ 4846 4846 public function lazyload_comment_meta( $check, $comment_id ) { 4847 4847 /* 4848 4848 * We only do this once per `WP_Query` instance. 4849 * Can't use `remove_ action()` because of non-unique object hashes.4849 * Can't use `remove_filter()` because of non-unique object hashes. 4850 4850 */ 4851 4851 if ( $this->updated_comment_meta_cache ) { 4852 4852 return $check;