wp_is_theme_directory_ignored() │ WP 6.0.0

Determines whether a theme directory should be ignored during export.

No Hooks.

Returns

bool. Whether this file is in an ignored directory.

Usage

wp_is_theme_directory_ignored( $path );
$path(string) (required)
The path of the file in the theme.

Changelog

Since 6.0.0 Introduced.

wp_is_theme_directory_ignored() code WP 7.1.2

function wp_is_theme_directory_ignored( $path ) {
	$directories_to_ignore = array( '.DS_Store', '.svn', '.git', '.hg', '.bzr', 'node_modules', 'vendor' );

	return array_any( $directories_to_ignore, fn( $directory ) => str_starts_with( $path, $directory ) );
}