搜索热词

WordPress中文社区 > 专栏 > WP终身学习者 > 让WordPress主题支持中文图片及中文附件上传

让WordPress主题支持中文图片及中文附件上传

发布于08月18日 被浏览 927 次

很多朋友在做wordpree主题制作的时候会经常遇到一个问题,那就是如果图片或附件是以中文命名的,就无法完成上传。关于这个问题的解决方法其实很简单,只需要在functions.php文件中插入下面的一段代码就可以了。亲测没问题的

/* 附件支持中文
/* -------------------------------- */
function wpyou_rename_upload_file_prefilter($file){
$time=date("Y-m-d");
$file['name'] = $time."".mt_rand(1,100).".".pathinfo($file['name'] , PATHINFO_EXTENSION);
return $file;
}
add_filter('wp_handle_upload_prefilter', 'wpyou_rename_upload_file_prefilter');
Related: recent deaths in montana, former eastenders actresses, wildland firefighter ppe checklist, st peregrine oil, asiana airlines covid travel requirements, , gemini and sagittarius relationship problems, murders in richmond va 1993, croton root system, walsh university baseball field, hannaford birthday cake catalog, how to read fruit roll up expiration date, homes for rent in cabarete dominican republic, what happened to jack in cider house rules, university hospital coventry pharmacy opening times,
点赞 已收藏 打赏 分享

8 条评论

无意义的评论将很快被删除,账号将被禁止发言。 发表评论 0/500
 
  1. WordPress日记

    不错,这个方法确实管用

  2. WordPress日记

    再添加一条一级评论看看

  3. WordPress日记

    再评论第二条一级的评论

  4. WordPress日记

    测试一下第一条评论怎么样!