WP_Scripts::in_default_dir( string $src ): bool

In this article

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

Parameters

$srcstringrequired
The source of the enqueued script.

Return

bool True if found, false if not.

Source

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

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

	foreach ( (array) $this->default_dirs as $test ) {
		if ( str_starts_with( $src, $test ) ) {
			return true;
		}
	}
	return false;
}

Changelog

VersionDescription
2.8.0Introduced.

User Contributed Notes

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