I’ve run into a problem with WordPress 3.0
I preface my image files with an underscore character (_somefile.jpg) to allow me to flag them for specific uses vs images that don’t have the underscore.
However, I’ve just found that the media uploader in WP 3.0 strips these underscores from the file name. At first I thought it was just renaming the wordpress title for the image but I’ve verified it in FTP and its actually renaming the file itself.
Is there a setting I can toggle via script to disable this filename editing?
Function
sanitize_file_name()inwp-includes/formatting.php, line 681:From the function documentation: “Trim period, dash and underscore from beginning and end of filename.”
There is a filter run after this
trim()namedsanitize_file_name. This code will fix your problem (untested):