[ WordPress.org  ](https://wordpress.org/)

  * [ News  ](https://wordpress.org/news/)
  * [ Showcase  ](https://wordpress.org/showcase/)
  * [ Hosting  ](https://wordpress.org/hosting/)
  * Extend 
    * [ Themes  ](https://wordpress.org/themes/)
    * [ Plugins  ](https://wordpress.org/plugins/)
    * [ Patterns  ](https://wordpress.org/patterns/)
    * [ Blocks  ](https://wordpress.org/blocks/)
    * [ Openverse  ↗  ︎  ](https://openverse.org/)
  * Learn 
    * [ Learn WordPress  ](https://learn.wordpress.org/)
    * [ Documentation  ](https://wordpress.org/documentation/)
    * [ Forums  ](https://wordpress.org/support/forums/)
    * [ Developers  ](https://developer.wordpress.org/)
    * [ WordPress.tv  ↗  ︎  ](https://wordpress.tv/)
  * Community 
    * [ Make WordPress  ](https://make.wordpress.org/)
    * [ Photo Directory  ](https://wordpress.org/photos/)
    * [ Five for the Future  ](https://wordpress.org/five-for-the-future/)
    * [ Events  ](https://events.wordpress.org/)
    * [ Job Board  ↗  ︎  ](https://jobs.wordpress.net/)
  * About 
    * [ About WordPress  ](https://wordpress.org/about/)
    * [ Enterprise  ](https://wordpress.org/enterprise/)
    * [ Gutenberg  ↗  ︎  ](https://wordpress.org/gutenberg/)
    * [ Swag Store  ↗  ︎  ](https://mercantile.wordpress.org/)
  * [ Get WordPress  ](https://wordpress.org/download/)

Search in WordPress.org

[ Get WordPress ](https://wordpress.org/download/)

[ WordPress.org  ](https://wordpress.org/)

[ WordPress Developer Resources ](https://developer.wordpress.org)

WP_Scripts::in_default_dir()

  * [ Developer Blog  ](https://developer.wordpress.org/news/)
  * [ Code Reference  ](https://developer.wordpress.org/reference/)
  * [ WP-CLI Commands  ](https://developer.wordpress.org/cli/commands/)

  * [ Developer Blog  ](https://developer.wordpress.org/news/)
  * [ Code Reference  ](https://developer.wordpress.org/reference/)
  * [ WP-CLI Commands  ](https://developer.wordpress.org/cli/commands/)

[ Home ](https://developer.wordpress.org) [ Reference
](https://developer.wordpress.org/reference/) [ Classes
](https://developer.wordpress.org/reference/classes/) [ WP_Scripts
](https://developer.wordpress.org/reference/classes/wp_scripts/)
WP_Scripts::in_default_dir()

Search

#  WP_Scripts::in_default_dir(  string  $src  ):  bool

##  In this article

Table of Contents

  * Parameters 
  * Return 
  * Source 
  * Related 
  * Changelog 

↑  Back to top

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

##  Parameters

` $src ` string  required

    

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

[ View all references ](https://developer.wordpress.org/reference/files/wp-
includes_class-wp-scripts-php-2/) [ View on Trac
](https://core.trac.wordpress.org/browser/tags/6.5/src/wp-includes/class-wp-
scripts.php#L776) [ View on GitHub ](https://github.com/WordPress/wordpress-
develop/blob/6.5/src/wp-includes/class-wp-scripts.php#L776-L791)

##  Related

Used by  |  Description   
---|---  
[ WP_Scripts::do_item() ](https://developer.wordpress.org/reference/classes/wp_scripts/do_item/) ` wp-includes/class-wp-scripts.php ` |  Processes a script dependency.   
  
##  Changelog

Version  |  Description   
---|---  
[ 2.8.0 ](https://developer.wordpress.org/reference/since/2.8.0/) |  Introduced.   
  
##  User Contributed Notes

You must [ log in
](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_scripts%2Fin_default_dir%2F)
before being able to contribute a note or feedback.

  * [ About ](https: