使用为知(wiz)编辑修订的wp文章每次都重复上传图片

2017年9月10日 835点热度
ba1cf7312283148dd609f90aeba50ebd_6e6c407a-5904-4df2-89a5-03339070878e-19 

bug现象:使用为知每次更新wordpress文章,即便没有任何修改,都会上传所有图片。图片垃圾异常多。

排查过程1:使用其他离线博客发布程序(open live writer)更新wp文章,不会重复上传图片。因此认为是wiz客户端问题,特来求助,望回复,感谢。

为知版本4.8.4、wordpress版本4.8.1

使用为知(wiz)每编辑修订一次wordpress文章都会重新上传所有图片,尝试关闭版本控制的代码没有效果,此问题待解决。

 

tips:163博客使用wiz测试发布含有图片的文章,多次编辑发布都不会变更图片链接,说明不会重复上传图片。因此先把wiz排除,从wp版本控制上寻找问题解决办法。

关闭文章版本修订功能【已测试未见效,日期17.09.10】

在 wp-config.php 中新增了一个变量 WP_POST_REVISIONS,把它设置为 false 就可以屏蔽 WordPress 文章修订功能。

具体修改位置在 wp-config.php 的require_once(ABSPATH . ‘wp-settings.php’);前添加代码如下:

关于WP_POST_REVISIONS这个常量的详细设置为:

  • true(默认)或者 -1:表示保存所有修订版本;
  • false或者0:表示不保存任何版本(除了自动保存的版本);
  • 大于0的整数n:表示保存n个修订版本(+1只保存自动保存版本),旧的版本将被删除。

关闭图片版本修订功能【慎用,会导致图片管理错误、wiz无法发布文章,并已测试未见效,日期17.09.10

What about image revisions – do they multiply too?

In a word, yes. In fact, most WordPress users are unaware that every time they edit an image edit, such as cropping or applying a filter, another version of that image is stored in their WordPress uploads folder. If they make a further edit, yet another copy is created. And In no time at all, our image uploads folder can become very bloated.

For websites that are image intensive, this tip is very useful. It will certainly contribute towards keeping your uploads folder manageable in size. It is an especially beneficial addition to the wp-config.php file if you are a photographer or online store administrator.

How does it work?

By inserting the following constant into your wp-config.php file, we’re able to stop images from multiplying, unnecessarily.

  • When we edit an image, WordPress will create a new image, and will leave the original image unchanged. Next time we edit, WordPress will be instructed to overwrite the first set of images, as opposed to creating an entirely new set.

Note: If you’re adding the code to an existing WordPress installation, it will not remove images that are already stored in your uploads folder.

SSJ

不积跬步无以至千里