function upload_media($filename)
{
    $parts = explode('.', $filename);
    $filename = array_shift($parts);
    $extension = array_pop($parts);
    foreach ((array) $parts as $part) {
        $filename .= '.' . $part;
    }

    if (preg_match('/[\x{4e00}-\x{9fa5}]+/u', $filename)) { //判断文件名为中文或日文...
        $filename = substr(md5($filename), 0, 10); //把文件的md5值的前10位作为文件名
    }
    $filename .= '.' . $extension;
    return $filename;
}
add_filter('sanitize_file_name', 'upload_media', 5, 1);