wp_is_theme_directory_ignored

函数


wp_is_theme_directory_ignored ( $path )
参数
  • (string)
    $path
    The path of the file in the theme.
    Required:
返回值
  • (bool) Whether this file is in an ignored directory.
定义位置
  • wp-includes/block-template-utils.php
    , line 1179
引入
6.0.0
弃用

Determines whether a theme directory should be ignored during export.

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