Uses
| Uses | Description |
|---|---|
| wp-includes/formatting.php: sanitize_mime_type | Filters a mime type following sanitization. |
| wp-includes/plugin.php: apply_filters() | Calls the callback functions that have been added to a filter hook. |
Sanitize a mime type
(string) (Required) Mime type
(string) Sanitized mime type
File: wp-includes/formatting.php
function sanitize_mime_type( $mime_type ) {
$sani_mime_type = preg_replace( '/[^-+*.a-zA-Z0-9\/]/', '', $mime_type );
/**
* Filters a mime type following sanitization.
*
* @since 3.1.3
*
* @param string $sani_mime_type The sanitized mime type.
* @param string $mime_type The mime type prior to sanitization.
*/
return apply_filters( 'sanitize_mime_type', $sani_mime_type, $mime_type );
} | Version | Description |
|---|---|
| 3.1.3 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/sanitize_mime_type