Incremental number handling on duplicate file names

The number is added in wp_unique_filename() in wp-includes/functions.php. You can prevent it by hooking into 'sanitize_file_name' and setting another file name.

You can find such functions and filters by following the code with your IDE. Most IDEs make functions clickable so you can go from their call to their declaration.

Here is an example from Eclipse PDT:

enter image description here

Leave a Comment