sanitize_file_name
Filter HookDescription
Filters a sanitized filename string.Hook Information
File Location |
wp-includes/formatting.php
View on GitHub
|
Hook Type | Filter |
Line Number | 2121 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$filename
|
Sanitized filename. |
string
|
$filename_raw
|
The filename prior to sanitization. |
Usage Examples
Basic Usage
<?php
// Hook into sanitize_file_name
add_filter('sanitize_file_name', 'my_custom_filter', 10, 2);
function my_custom_filter($filename, $filename_raw) {
// Your custom filtering logic here
return $filename;
}
Source Code Context
wp-includes/formatting.php:2121
- How this hook is used in WordPress core
<?php
2116 * @since 2.8.0
2117 *
2118 * @param string $filename Sanitized filename.
2119 * @param string $filename_raw The filename prior to sanitization.
2120 */
2121 return apply_filters( 'sanitize_file_name', $filename, $filename_raw );
2122 }
2123
2124 /**
2125 * Sanitizes a username, stripping out unsafe characters.
2126 *
PHP Documentation
<?php
/**
* Filters a sanitized filename string.
*
* @since 2.8.0
*
* @param string $filename Sanitized filename.
* @param string $filename_raw The filename prior to sanitization.
*/
Quick Info
- Hook Type: Filter
- Parameters: 2
- File: wp-includes/formatting.php
Related Hooks
Related hooks will be displayed here in future updates.