Make WordPress Core

Ticket #34047: 34047.3.diff

File 34047.3.diff, 2.5 KB (added by dlh, 10 years ago)
  • src/wp-includes/query.php

     
    35613561
    35623562
    35633563                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 );
    35653565                }
    35663566
    35673567                if ( ! $q['suppress_filters'] ) {
     
    36933693
    36943694                // If comments have been fetched as part of the query, make sure comment meta lazy-loading is set up.
    36953695                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 );
    36973697                }
    36983698
    36993699                if ( ! $q['suppress_filters'] ) {
     
    47684768         * @since 4.4.0
    47694769         * @access public
    47704770         *
    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.
    47724772         * @param int  $term_id ID of the term whose metadata is being cached.
    47734773         * @return mixed In order not to short-circuit `get_metadata()`. Generally, this is `null`, but it could be
    47744774         *               another value if filtered by a plugin.
     
    47764776        public function lazyload_term_meta( $check, $term_id ) {
    47774777                /*
    47784778                 * 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.
    47804780                 */
    47814781                if ( $this->updated_term_meta_cache ) {
    47824782                        return $check;
     
    48394839         *
    48404840         * @since 4.4.0
    48414841         *
    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.
    48434843         * @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'.
    48454845         */
    48464846        public function lazyload_comment_meta( $check, $comment_id ) {
    48474847                /*
    48484848                 * 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.
    48504850                 */
    48514851                if ( $this->updated_comment_meta_cache ) {
    48524852                        return $check;