关闭WordPress文章修订功能

大家在发表和编辑文章的时候,可能都不喜欢WordPress 自动保存(AutoSave)和文章历史修订版本(Revisions)的功能。一方面网速不好的时候,它会影响编辑和发表文章页面的加载速度;另一方面这些文章的历史修订版本都会写入数据库保存,无形中大大增加了数据库的膨胀速度,冗余数据太多也影响数据库的存取查询效率。wp管理后台并没有提供关闭功能选项。那么如何禁用WordPress自动保存和文章历史修订版本功能呢?这也是WordPress优化数据库第一步要做的内容。方法一:修改wp-config.php 文件

(程序文件的编辑,请使用专业的编辑器如 EmEditor 来编辑,不要使用记事本之类的,容易出现首页版面偏左、WLW打开出错的问题,以及其他隐藏错误,这是我的教训,切记切记)编辑wordpress的安装目录下的 wp-config.php 文件,在下面文字之后(基本上快在最后了):
/** 设置WordPress变量和包含文件。 */ ( 或 /** Sets up WordPress vars and included files. */ )
添加以下代码:
define(‘WP_POST_REVISIONS’,’0′);
上述代码是屏蔽掉“Revision”,有几个参数可选,根据实际需要修改(蓝色部分,本处就是指的0):
true(默认)或者 -1:保存所有修订版本
false 或者 0:不保存任何版本(除了自动保存的版本)
大于 0的整数 n:保存 n 个修订版本(+1 只保存自动保存版本),旧的版本将被删除。
具体说明请查看官方的说明文档“Revision Management”
此方法的不足在于,wordpress主程序升级后,需要重新设置(也许今后会增加这么一个开关按钮,没现在这么麻烦)。

方法二:使用插件法

使用的插件就是: disable-revisions,方法很简单,进入后台激活即可,不需要再设置什么

清除数据库中的修订版
安全起见,操作前请先备份数据!
方法一:使用WP Cleaner插件来完成
1.下载插件 WP Cleaner(点击下载,或访问插件主页)
2.将下载的文件解压后上传到博客 wp-content/plugins/ 目录下
3.在后台的“插件”项中启用
4.点击“设置”即可看到“WP Cleaner”项
5.按提示删除修订版。

方法三:手动清除数据库中的修订版 (此方法高效而且无副作用。)

首先登录你的cPanel——>数据库——>phpMyAdmin——SQL,然后输入以下 SQL 语句点执行即可把所有的Post Revision清除:
DELETE FROM wp_posts WHERE post_type = “revision”;
当然对于不熟悉sql语句的朋友可要谨慎使用了,不小心输错语句那可是相当危险的(注意这里的wp_什么表示数据库前缀,如果你修改了默认的wp前缀,则需要改为你自己的,否则会报告没找到);不过不用怕,这里还有一个简单明了的方法,免去你的担忧。
1.打开你的wordpress数据库,展开表 wp_posts(注意这里的wp_什么表示数据库前缀,如果你修改了默认的wp前缀,则查看你自己的xxx_posts),点击左上角的浏览,这表里包含的数据有page(页面)、post(文章)、revision(修订);
2.点击“post_type”子键进行分类排序,把所有显示“revision”的ID都勾选上(可能有多页,需要不断的重复),看清楚来,是键值为“revision”的才勾哟;
3.然后点删除。大功告成!新的和旧的“revision”都拜拜了。

关闭wordpress的自动保存功能
编辑wordpress的安装目录下的 wp-config.php 文件,在下面文字之后(基本上快在最后了):
/** 设置WordPress变量和包含文件。 */ ( 或 /** Sets up WordPress vars and included files. */ )
添加以下代码:
define(‘AUTOSAVE_INTERVAL’, ‘3600′);
上述代码会将自动保存时间间隔改为3600秒,即60分钟。

更多相关文章:
关闭WordPress文章自动保存以及修订功能(版本控制功能)(附带插件)

如何应用禁用自动保存和关闭文章修订版本的WordPress插件

禁用WordPress文章修订版本和自动保存功能

关闭WordPress文章修订功能》上有10条评论

  1. LouisCok

    This phosphodiesterase inhibitor, select the appropriate manner of the fifth generation http://cialiswalmartoverthecounter.net. Erogenous zone during stimulation of nitric oxide manufacture, including the effects of phosphodiesterase type 5 in other major erectile tissue of the penis to the rest of the vascular smooth musculature. Wewiti blood vessels and blood flow in a large corpus. This method of manufacturing. Because Cialis you do not eat, do without sexual stimulation. Related strong chemicals, please contact vitro when tested in a solution not only to put it into the penis, cerebrum, kidneys, problems bowel movement and light, there is, in addition, all of which supply blood to the body inches Ships Nevertheless, these thousands of times stronger than Cialis Go to the enzyme, present in the erectile tissue in the penis ten such measures. It refers to the state of the remedy and the retina. This may explain some of the side effects of this drug. And have a positive impact on manufacturing raises a man’s sexual function. Medical treatment is 15 minutes, it lasted six days. If the drug is not blood pressure, the effect of treatment on heart muscle disease. Cialis does not cause degradation of the color in the same direction and other drugs. This does not affect the other parameters of the remedy and intraocular pressure, and body vision.

    [回复]

    回复
  2. CharlesRes

    hOur company provides a wide variety of health and related products. Take a look at our health contributing website in case you want to look better. Our company provides a wide variety of non prescription products. Look at our health website in case you want to look better with a help of generic supplements. Our company provides a wide variety of non prescription drugs. Look at our health portal in case you want to to improve your health with a help health products. Our company provides herbal general health products. Visit our health contributing site in case you want to look better. Our company provides a wide variety of non prescription products. Look at our health portal in case you want to to improve your health with a help of generic supplements. Our company offers a wide variety of non prescription products. Visit our health site in case you want to look better with a help generic supplements.
    Our company provides a wide variety of healthcare products. Look at our health contributing website in case you want to feel better. Our company offers health products. Look at our health contributing portal in case you want to look healthier. Our company provides a wide variety of non prescription products. Visit our health site in case you want to strengthen your health with a help health products. Our company offers a wide variety of non prescription products. Visit our health contributing portal in case you want to improve your health. Our company offers safe health and related products. Look at our health contributing website in case you want to look better.

    [回复]

    回复

CharlesRes进行回复 取消回复

邮箱地址不会被公开。 必填项已用*标注