WP_Metadata_Lazyloader::reset_queue() WordPress Method

The WP_Metadata_Lazyloader::reset_queue() method is used to reset the lazy-loading queue. This is useful for when you need to load new data or want to ensure that all data is loaded fresh.

WP_Metadata_Lazyloader::reset_queue( string $object_type ) #

Resets lazy-load queue for a given object type.


Parameters

$object_type

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


Top ↑

Return

(void|WP_Error) WP_Error on failure.


Top ↑

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'] );
	}


Top ↑

Changelog

Changelog
VersionDescription
4.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.