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 inwp-config.php

Limit the Maximum no. of Post revisions

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

 define ('WP_POST_REVISIONS', 3);

By adding above code you are limit themaximum 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 coderequire_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.

Để lại một bình luận

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 *