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.
定义位置
相关方法
search_theme_directoriesregister_theme_directorywp_is_recovery_modeget_template_directory_uriget_template_directory
引入
6.0.0
弃用
-

wp_is_theme_directory_ignored: 这个函数用来检查给定的主题目录是否在WordPress中被忽略。它接收一个主题目录名称作为参数,如果该目录被忽略,则返回true,否则返回false。

确定在导出过程中是否应该忽略一个主题目录。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
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;
}
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; }
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;
}

常见问题

FAQs
查看更多 >