pre_wp_unique_filename_file_list хук-фильтрWP 5.5.0

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

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

Использование

add_filter( 'pre_wp_unique_filename_file_list', 'wp_kama_pre_wp_unique_filename_file_list_filter', 10, 3 );

/**
 * Function for `pre_wp_unique_filename_file_list` filter-hook.
 * 
 * @param array|null $files    The list of files to use for filename comparisons.
 * @param string     $dir      The directory for the new file.
 * @param string     $filename The proposed filename for the new file.
 *
 * @return array|null
 */
function wp_kama_pre_wp_unique_filename_file_list_filter( $files, $dir, $filename ){

	// filter...
	return $files;
}
$files(массив|null)
The list of files to use for filename comparisons.
По умолчанию: null (to retrieve the list from the filesystem)
$dir(строка)
The directory for the new file.
$filename(строка)
The proposed filename for the new file.

Список изменений

С версии 5.5.0 Введена.

Где вызывается хук

wp_unique_filename()
pre_wp_unique_filename_file_list
wp-includes/functions.php 2667
$files = apply_filters( 'pre_wp_unique_filename_file_list', null, $dir, $filename );

Где используется хук в WordPress

Использование не найдено.