Skip to content

Instantly share code, notes, and snippets.

@Dianakc
Last active December 16, 2015 06:19
Show Gist options
  • Save Dianakc/b32df6af7322a3e765e9 to your computer and use it in GitHub Desktop.
Save Dianakc/b32df6af7322a3e765e9 to your computer and use it in GitHub Desktop.
Adiciona um hash e/outras coisas no arquivo enviado
<?php
function make_filename_hash($filename) {
$nomedosite = get_bloginfo('name');
$info = pathinfo($filename);
$ext = empty($info['extension']) ? '' : '.' . $info['extension'];
$name = basename($filename, $ext);
return $nomedosite.'_'.md5($name) . $ext;
}
add_filter('sanitize_file_name', 'make_filename_hash', 10);
;?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment