W3cubDocs

/WordPress

WP_Metadata_Lazyloader::lazyload_comment_meta( mixed $check )

Lazy-loads comment meta for queued comments.

Description

This method is public so that it can be used as a filter callback. As a rule, there is no need to invoke it directly, from either inside or outside the WP_Query object.

Parameters

$check

(mixed) (Required) The $check param passed from the 'get_comment_metadata' hook.

Return

(mixed) The original value of $check, so as not to short-circuit get_comment_metadata().

Source

File: wp-includes/class-wp-metadata-lazyloader.php

public function lazyload_comment_meta( $check ) {
		if ( ! empty( $this->pending_objects['comment'] ) ) {
			update_meta_cache( 'comment', array_keys( $this->pending_objects['comment'] ) );

			// No need to run again for this set of comments.
			$this->reset_queue( 'comment' );
		}

		return $check;
	}

Changelog

Version Description
4.5.0 Introduced.

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_metadata_lazyloader/lazyload_comment_meta