Automattic\WooCommerce\Blocks

DependencyDetection::is_wordpress_core_scriptprivateWC 1.0

Check if a script URL belongs to WordPress core.

WordPress core scripts (wp-includes, wp-admin) won't use wc.* globals, so we can skip them to reduce registry size.

Method of the class: DependencyDetection{}

No Hooks.

Returns

true|false.

Usage

// private - for code of main (parent) class only
$result = $this->is_wordpress_core_script( $url ): bool;
$url(string) (required)
Script URL.

DependencyDetection::is_wordpress_core_script() code WC 10.8.1

private function is_wordpress_core_script( string $url ): bool {
	return (bool) preg_match( '#/(wp-includes|wp-admin)/#', $url );
}