diff --git a/wp-includes/functions.php b/wp-includes/functions.php index db38c6d65d..3525712071 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -2003,7 +2003,18 @@ function wp_unique_filename( $dir, $filename, $unique_filename_callback = null ) $filename2 = str_replace( array( "-$number$ext2", "$number$ext2" ), "-$new_number$ext2", $filename2 ); $number = $new_number; } - return $filename2; + + /** + * Filter the result when generating a unique file name. + * + * @since 4.5.0 + * + * @param string $filename Unique file name. + * @param string $ext File extension, eg. ".png". + * @param string $dir Directory path. + * @param callable|null $unique_filename_callback Callback function that generates the unique file name. + */ + return apply_filters( 'wp_unique_filename', $filename2, $ext, $dir, $unique_filename_callback ); } while ( file_exists( $dir . "/$filename" ) ) { @@ -2015,7 +2026,8 @@ function wp_unique_filename( $dir, $filename, $unique_filename_callback = null ) } } - return $filename; + /** This filter is documented in wp-includes/functions.php */ + return apply_filters( 'wp_unique_filename', $filename, $ext, $dir, $unique_filename_callback ); } /** diff --git a/wp-includes/version.php b/wp-includes/version.php index 1761d3fff6..1f747fb00c 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.5-alpha-36309'; +$wp_version = '4.5-alpha-36310'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.