WP_Dependencies::query( string $handle, string $list = 'registered' )

Query list for an item.


Description Description


Parameters Parameters

$handle

(string) (Required) Name of the item. Should be unique.

$list

(string) (Optional) Property name of list array.

Default value: 'registered'


Top ↑

Return Return

(bool|_WP_Dependency) Found, or object Item data.


Top ↑

Source Source

File: wp-includes/class.wp-dependencies.php

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

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

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

			case 'done':
			case 'printed': // back compat
				return in_array( $handle, $this->done );
		}
		return false;
	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.6.0 Moved from WP_Scripts.
2.1.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

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