diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index d7b012198d..d9cb58f662 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -1767,7 +1767,8 @@ function wp_handle_upload(&$file, $overrides = false) { else $filename = str_replace("$number$ext", ++$number . $ext, $filename); } - $filename = preg_replace('#\.(?![^.]+$)#', '-', $filename); + $filename = str_replace($ext, '', $filename); + $filename = sanitize_title_with_dashes($filename) . $ext; } // Move the file to the uploads dir