Gets 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 function allows the caller to use their own method to create unique file names. If defined, the callback should take three arguments: - directory, base filename, and extension - and return a unique filename.
$dir, $filename, $unique_filename_callback = null
Sortie :
@param string $dir Directory. @param string $filename File name. @param callable $unique_filename_callback Callback. Default null. @return string New filename, if given wasn't unique.
// Utilisation de la fonction wp_unique_filename
$result = wp_unique_filename($dir, $filename, $unique_filename_callback = null);
if ($result) {
// Votre logique ici
}
Chargement des actualités...