WP_Dependencies::query( string $handle, string $status = ‘registered’ ): bool|_WP_Dependency

In this article

Query the list for an item.

Parameters

$handlestringrequired
Name of the item. Should be unique.
$statusstringoptional
Status of the item to query. Default 'registered'.

Default:'registered'

Return

bool|_WP_Dependency Found, or object Item data.

Source

public function query( $handle, $status = 'registered' ) {
	switch ( $status ) {
		case 'registered':
		case 'scripts': // Back compat.
			if ( isset( $this->registered[ $handle ] ) ) {
				return $this->registered[ $handle ];
			}
			return false;

		case 'enqueued':
		case 'queue': // Back compat.
			if ( in_array( $handle, $this->queue, true ) ) {
				return true;
			}
			return $this->recurse_deps( $this->queue, $handle );

		case 'to_do':
		case 'to_print': // Back compat.
			return in_array( $handle, $this->to_do, true );

		case 'done':
		case 'printed': // Back compat.
			return in_array( $handle, $this->done, true );
	}

	return false;
}

Changelog

VersionDescription
2.6.0Moved from WP_Scripts.
2.1.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.