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。

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

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
查看更多 >
闪电侠

(工作日 10:00 - 18:30 为您服务)

2025-12-05 19:32:59

您好,无论是售前、售后、意见建议……均可通过联系工单与我们取得联系。

您也可选择聊天工具与我们即时沟通或点击查看:

您的工单我们已经收到,我们将会尽快跟您联系!
取消
选择聊天工具: