wp_is_theme_directory_ignored( string $path ): bool

In this article

Determines whether a theme directory should be ignored during export.

Parameters

$pathstringrequired
The path of the file in the theme.

Return

bool Whether this file is in an ignored directory.

Source

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

Changelog

VersionDescription
6.0.0Introduced.

User Contributed Notes

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