If you want to rename the file name at the time of upload, it is a right place to know the solution. Let's discuss this requirement.
We all know there are many hooks available in Wordpress. We will use the filter named sanitize_file_name. You can simply put the code in function.php
function renameMedia($medianame)
{
$data = pathinfo($medianame);
$newName = basename($filename);
return md5($newName) . '.' . $data['extension'];
}
add_filter('sanitize_file_name','renameMedia');
0 Comment(s)