wp_unique_filename ( $dir, $filename, $unique_filename_callback = null )

  • (string) dir Directory.
  • (string) filename File name.
  • (callable) unique_filename_callback Callback. Default null.
  • (string) New filename, if given wasn't unique.
Defined at:


Get a filename that is sanitized and unique for the given directory.If the filename is not unique, then a number will be added to the filename before the extension, and will continue adding numbers until the filename is unique. The callback is passed three parameters, the first one is the directory, the second is the filename, and the third is the extension.

Related Functions

wp_unique_id, sanitize_file_name, wp_unique_term_slug, pclziputilrename, wp_enqueue_style

Top Google Results

User discussions

wpseek mobile