W3cubDocs

/WordPress

WP_Metadata_Lazyloader::reset_queue( string $object_type )

Resets lazy-load queue for a given object type.

Description

Parameters

$object_type

(string) (Required) Object type. Accepts 'comment' or 'term'.

Return

(bool|WP_Error) True on success, WP_Error on failure.

Source

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

public function reset_queue( $object_type ) {
		if ( ! isset( $this->settings[ $object_type ] ) ) {
			return new WP_Error( 'invalid_object_type', __( 'Invalid object type' ) );
		}

		$type_settings = $this->settings[ $object_type ];

		$this->pending_objects[ $object_type ] = array();
		remove_filter( $type_settings['filter'], $type_settings['callback'] );
	}

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/reset_queue