钩子文档

sanitize_file_name_chars

💡 云策文档标注

概述

sanitize_file_name_chars 是一个 WordPress 过滤器,用于自定义在文件名清理过程中需要移除的特殊字符列表。它允许开发者修改默认的字符移除规则,以适配特定需求。

关键要点

  • 过滤器名称:sanitize_file_name_chars
  • 参数:$special_chars(数组,要移除的字符列表)和 $filename_raw(字符串,原始文件名)
  • 用途:在 sanitize_file_name() 函数中调用,影响文件名清理行为
  • 引入版本:WordPress 2.8.0

📄 原文内容

Filters the list of characters to remove from a filename.

Parameters

$special_charsstring[]
Array of characters to remove.
$filename_rawstring
The original filename to be sanitized.

Source

$special_chars = apply_filters( 'sanitize_file_name_chars', $special_chars, $filename_raw );

Changelog

Version Description
2.8.0 Introduced.