网上看到的,暂时放在这里。

/**
 * @see wp_handle_upload()
 
*/
function example_wp_handle_upload_prefilter($files){
    $files['name'] = md5($files['name']) . $_SERVER['REQUEST_TIME']. mt_rand(0, 10000);
    $files['name'] .= '.' . pathinfo($files['name'] , PATHINFO_EXTENSION);
    return $files;
}
add_filter('wp_handle_upload_prefilter', 'example_wp_handle_upload_prefilter');

 

 通过wp_handle_upload_prefilter这个filter完成重命名的

 

posted on 2012-04-11 22:41  争轮  阅读(226)  评论(0编辑  收藏  举报