apply_filters( ‘pre_wp_unique_filename_file_list’, array|null $files, string $dir, string $filename )

In this article

Filters the file list used for calculating a unique filename for a newly added file.

Description

Returning an array from the filter will effectively short-circuit retrieval from the filesystem and return the passed value instead.

Parameters

$filesarray|null
The list of files to use for filename comparisons.
Default null (to retrieve the list from the filesystem).
$dirstring
The directory for the new file.
$filenamestring
The proposed filename for the new file.

Source

$files = apply_filters( 'pre_wp_unique_filename_file_list', null, $dir, $filename );

Changelog

VersionDescription
5.5.0Introduced.

User Contributed Notes

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