WP_Scripts::in_default_dir() WordPress Method

The WP_Scripts::in_default_dir() method is a boolean method that determines whether a given script is in the default directory for scripts.

WP_Scripts::in_default_dir( string $src ) #

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


Parameters

$src

(string)(Required)The source of the enqueued script.


Top ↑

Return

(bool) True if found, false if not.


Top ↑

Source

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

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

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

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


Top ↑

Changelog

Changelog
VersionDescription
2.8.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.