WordPress Random Name for Uploaded Files
How to upload files to WordPress and automatically rename them without using the name of the file you are uploading.
The sample solution is to simply add a couple of the below code to your functions.php file to change all uploaded images to a simple randomized file name, and then trim it down to the first 8 characters to make sure that image paths in the HTML aren’t too crazy.