Connect with us

How to Disable or Limit Post Revision in WordPress

coding

How to Disable or Limit Post Revision in WordPress

WordPress has the post revisions concept which saves your post data at regular intervals. This means if your browser crashes or in any other unexpected circumstance, you might loose your written post. By this Post Revision, WordPress saves your post content after a certain amount of time. So there are many Post Revisions saved in your database, which is useless once your post is published. Also it increases the database load and as a result load time of your page is increased. So here is how to delete post revisions in WordPress:

DELETE a,b,c FROM wp_posts a
LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id)
LEFT JOIN wp_postmeta c ON (a.ID = c.post_id)
WHERE a.post_type = ‘revision’

Above MySQL query will remove all revision post from your database.

But, suppose you don’t want to save Revision Posts than you may disable it by writing a single line of code in wp-config.php file. Also you can limit the Post Revisions in WordPress. So here is how to disable or limit Post Revisions in WordPress. Add below line of code in wp-config.php file which is located in root folder of your WordPress. This will completely disable Post Revision.

// For Disable Post Revision WordPress
define(‘WP_POST_REVISIONS’, ‘false’);
// For Limit Post Revision WordPress
define(‘WP_POST_REVISIONS’, 5);

Continue Reading
You may also like...
Click to comment

Leave a Reply

Your email address will not be published. Required fields are marked *

More in coding

To Top
Grab the largest plugin bundle from CodeCanyon!