sanitize_file_name ( $filename )

  • (string) filename The filename to be sanitized.
  • (string) The sanitized filename.
Defined at:


Sanitizes a filename, replacing whitespace with dashes.Removes special characters that are illegal in filenames on certain operating systems and special characters requiring special escaping to manipulate at the command line. Replaces spaces and consecutive dashes with a single dash. Trims period, dash and underscore from beginning and end of filename. It is not guaranteed that this function will return a filename that is allowed to be uploaded.

Related Functions

sanitize_locale_name, sanitize_title, sanitize_term, sanitize_meta, sanitize_email

Top Google Results

User discussions

wpseek mobile