WP_Scripts::in_default_dirpublicWP 2.8.0

Whether a handle's source is in a default directory.

Method of the class: WP_Scripts{}

No Hooks.

Returns

bool. True if found, false if not.

Usage

global $wp_scripts;
$wp_scripts->in_default_dir( $src );
$src(string) (required)
The source of the enqueued script.

Changelog

Since 2.8.0 Introduced.

WP_Scripts::in_default_dir() code WP 7.1

public function in_default_dir( $src ) {
	if ( ! $this->default_dirs ) {
		return true;
	}

	if ( str_starts_with( $src, '/' . WPINC . '/js/l10n' ) ) {
		return false;
	}

	return array_any( (array) $this->default_dirs, fn( $test ) => str_starts_with( $src, $test ) );
}