apply_filters( 'wp_unique_filename', string $filename, string $ext, string $dir, callable|null $unique_filename_callback, string[] $alt_filenames, int|string $number )

Filters the result when generating a unique file name.



(string) Unique file name.


(string) File extension. Example: ".png".


(string) Directory path.


(callable|null) Callback function that generates the unique file name.


(string[]) Array of alternate file names that were checked for collisions.


(int|string) The highest number that was used to make the file name unique or an empty string if unused.

Top ↑


File: wp-includes/functions.php

View on Trac

Top ↑


Version Description
5.8.1 The $alt_filenames and $number parameters were added.
4.5.0 Introduced.

Top ↑

User Contributed Notes

You must log in before being able to contribute a note or feedback.