Customize your theme in the Theme Customizer panel. See changes live without page reloading.   

WordPress上传图片HTTP错误的解决方法

当前位置:
估计的阅读时间: < 1分钟

很多朋友在编辑文章的情况下需要往媒体库上传图片常常会遇到上传完毕时出现http错误的提示。
WordPress上传图片HTTP错误的解决方法
网上的方法千篇一律,要么修改服务器设置,要么改.htaccess文件。如你的主机支持 .htaccess,你知需要修改 .htaccess ,添加如下代码即可:

  1. <IfModule mod_security.c>
  2. <Files async-upload.php>
  3. SecFilterEngine Off
  4. SecFilterScanPOST Off
  5. </Files>
  6. </IfModule>

而今天为大家提供一种更实用的方法,利用wp的过滤器来修复此http错误。将下面的代码添加到主题的functions.php文件中即可。代码来自WordPress官网。WordPress.org

  1. add_filter( ‘wp_image_editors’, ‘change_graphic_lib’ );
  2. function change_graphic_lib($array) {
  3. return array( ‘WP_Image_Editor_GD’, ‘WP_Image_Editor_Imagick’ );
  4. }
–结束–
这篇文章有帮助吗?
浏览: 0
Call to action title here