How to set Maximum number of Post Revisions without using a Plugin.

Few weeks before I was using a plugin to limit the Post revisions but then I got to know the that,using plugins for small functionality like this can make your blog worse.

Actually using too many WordPress plugins isn’t a harm for your blog but even using a one poorly coded plugin is enough to make your blog vulnerable to security attacks.

So,for small tweaks like this you can edit the code rather than installing a standalone plugin.

What is Post revisions & Why should we limit it ?

Every time you change a content the new copy of the content will be created rather than deleting the existing one.The advantage of the post revision is you can always revert back to previous revisions with just a single click.

So,If you are not limiting the post revisions then you are collecting junks in your blog database.Large size database causes many problems like server slow down and also It will become cumbersome process to backup your WordPress blog.

So what can we do ? Simple,Just add a line of code in wp-config.php

Limit the Maximum no. of Post revisions

Open wp-config.php file which will be located in your blog’s root folder and Add the following code anywhere before the code require_once(ABSPATH . 'wp-settings.php');

 define ('WP_POST_REVISIONS', 3);

By adding above code you are limit the maximum post revisions to 3,You can change it to any value according to your need.

Disable the post revisions

If you are not interested to create post revisions then completely disable it by adding the following code anywhere before the code require_once(ABSPATH . 'wp-settings.php');

 define ('WP_POST_REVISIONS', false);

But I recommend you to have at least 3 post revisions to avoid any loss of data.

Related Posts

Kinh Bắc News

Kinh Bắc Web Blog’s chuyên cập nhật chia sẻ thông tin kiến thức kinh nghiệm thiết kế và nhiều nội dung hấp dẫn. Theo dõi chúng tôi để cập nhật thêm nhiều kiến thức thông tin thú vị nhé. Website: | |

Trả lời

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *