WP_Dependencies::query

Advertisement

Summery Summery

Query list for an item.

Syntax Syntax

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

Parameters Parameters

$handle

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

$list

(Optional) Property name of list array. Default 'registered'.

Default value: 'registered'

Return Return

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

Source Source

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

	 * @param string $list   Optional. Property name of list array. Default 'registered'.
	 * @return bool|_WP_Dependency Found, or object Item data.
	 */
	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, 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 );

Advertisement

Changelog Changelog

Changelog
Version Description
2.6.0 Moved from WP_Scripts.
2.1.0 Introduced.

Advertisement

Leave a Reply