sanitize_file_name_chars
Filters the list of characters to remove from a filename.
Usage
add_filter( 'sanitize_file_name_chars', 'wp_kama_sanitize_file_name_chars_filter', 10, 2 ); function wp_kama_sanitize_file_name_chars_filter( $special_chars, $filename_raw ){ // filter... return $special_chars; }
- $special_chars(string[])
- Array of characters to remove.
- $filename_raw(string)
- The original filename to be sanitized.
Changelog
Since 2.8.0 | Introduced. |
Where the hook is called
sanitize_file_name_chars
wp-includes/formatting.php 2023
$special_chars = apply_filters( 'sanitize_file_name_chars', $special_chars, $filename_raw );