Connect with us

How to Disable or Limit Post Revision in WordPress


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
Click to comment

Leave a Reply

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

More in coding

About Me:

Szabi Kisded

Hey there, I'm Szabi. At 30 years old, I quit my IT job and started my own business and became a full time WordPress plugin developer, blogger and stay-at-home dad. Here I'm documenting my journey earning an online (semi)passive income. Read more

Sign up for my newsletter and get the YouTube Caption Scraper WordPress plugin for free
(worth 29$)!

All My Plugins In A Bundle:

My AutoBlogging Plugins:

My Online Courses:

A Theme I Recommend:

Featured Posts:

To Top