如何在WordPress中禁用后期修订并减小数据库大小

Post revisions is a great feature that WordPress has to offer but for some users it might not be the best option. For users who have limited database space, or for users creating WordPress as a CMS where they don’t need autosave, they can simply disable Post Revisions feature in WordPress by following this tutorial. By reducing the database size, you can also speed up your site.

修订版是WordPress必须提供的一项很棒的功能,但对于某些用户而言,它可能不是最佳选择。 对于数据库空间有限的用户,或将WordPress创建为不需要自动保存的CMS的用户,只需按照本教程的说明在WordPress中禁用“发布修订”功能。 通过减小数据库大小,您还可以加快站点速度。

Open wp-config.php located in your WordPress root directory and add the following code:

打开位于WordPress根目录中的wp-config.php并添加以下代码:

define('AUTOSAVE_INTERVAL', 300 ); // seconds
define('WP_POST_REVISIONS', false );

This code will disable all future revisions to be saved and it will also increase your autosave interval from 60 seconds to 300 seconds, so it means your post will be autosaving every 5 minute instead of every minute.

此代码将禁用所有将来的修订版本,并将自动保存间隔从60秒增加到300秒,因此这意味着您的帖子将每5分钟自动保存一次,而不是每分钟。

The above code, will not delete your past revisions that are already saved in your database. To delete all previous revisions, you will need to visit PHPMyAdmin and run the following SQL query.

上面的代码不会删除数据库中已经保存的以前的修订。 要删除所有以前的修订,您将需要访问PHPMyAdmin并运行以下SQL查询。

DELETE FROM wp_posts WHERE post_type = "revision";

This should disable Post revisions and delete all previously saved post revisions stored in your Database.

这将禁用后期修订,并删除数据库中存储的所有以前保存的后期修订。

Disclaimer: We are not suggesting that Post Revisions is a bad option. This tutorial is only for those who are in the situation where they need to reduce their database size.

免责声明:我们不建议发布修订版是一个不好的选择。 本教程仅适用于需要减少数据库大小的情况。

翻译自: https://www.wpbeginner.com/wp-tutorials/how-to-disable-post-revisions-in-wordpress-and-reduce-database-size/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值