WP_Dependencies::query()publicWP 2.1.0

Query the list for an item.

Метод класса: WP_Dependencies{}

Хуков нет.

Возвращает

true|false|_WP_Dependency. Found, or object Item data.

Использование

$WP_Dependencies = new WP_Dependencies();
$WP_Dependencies->query( $handle, $status );
$handle(строка) (обязательный)
Name of the item. Should be unique.
$status(строка)
Status of the item to query.
По умолчанию: 'registered'

Список изменений

С версии 2.1.0 Введена.
С версии 2.6.0 Moved from WP_Scripts.

Код WP_Dependencies::query() WP 6.5.2

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;
}