Filter hook 'wp_unique_filename'

in WP Core File wp-includes/functions.php at line 2792

Description

Filters the result when generating a unique file name.

Occurrences

Filename Line Number
wp-includes/functions.php 2792

Parameters

Type Name Description
string $filename Unique file name.
string $ext File extension. Example: ".png".
string $dir Directory path.
callable|null $unique_filename_callback Callback function that generates the unique file name.
string[] $alt_filenames Array of alternate file names that were checked for collisions.
int|string $number The highest number that was used to make the file name unique or an empty string if unused.

PHP Doc

/**
	 * Filters the result when generating a unique file name.
	 *
	 * @since 4.5.0
	 * @since 5.8.1 The `$alt_filenames` and `$number` parameters were added.
	 *
	 * @param string        $filename                 Unique file name.
	 * @param string        $ext                      File extension. Example: ".png".
	 * @param string        $dir                      Directory path.
	 * @param callable|null $unique_filename_callback Callback function that generates the unique file name.
	 * @param string[]      $alt_filenames            Array of alternate file names that were checked for collisions.
	 * @param int|string    $number                   The highest number that was used to make the file name unique
	 *                                                or an empty string if unused.
	 */