wpseek.com
A WordPress-centric search engine for devs and theme authors



wp_is_theme_directory_ignored › WordPress Function

Since6.0.0
Deprecatedn/a
wp_is_theme_directory_ignored ( $path )
Parameters:
  • (string) $path The path of the file in the theme.
    Required: Yes
Returns:
  • (bool) Whether this file is in an ignored directory.
Defined at:
Codex:

Determines whether a theme directory should be ignored during export.



Source

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

	foreach ( $directories_to_ignore as $directory ) {
		if ( str_starts_with( $path, $directory ) ) {
			return true;
		}
	}

	return false;
}