WordPress上传中文附件不显示解决方法

wordpress 上传中文附件出现乱码和后台上传中文图片不显示解决方法,编辑 wp-admin/includes/file.php 这个文件:
1、查找:

  1. $new_file = $uploads['path'] . "/$filename";

替换为:

  1. $new_file = $uploads['path'] . "/" . iconv("UTF-8","GB2312",$filename);

注意,只需要替换第一处即可!
2、查找

  1. return apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ), 'upload' );

修改为:(修正中文文件名编码问题)

  1. return apply_filters( 'wp_handle_upload', array( 'file' => $uploads['path'] . "/$filename", 'url' => $url, 'type' => $type ) , 'upload');
© 版权声明
THE END
喜欢就支持以下吧
点赞0赞赏
分享
相关推荐
  • 暂无相关文章
评论 抢沙发