• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer

Nile Flores Media

Helping You Rock Out Your Website Like A Rockstar

  • Home
  • About
  • Blog
  • Portfolio
  • Hire Me
  • Resources
  • Contact
  • Blogging
  • WordPress
  • Social Media
  • SEO
  • Web Design
  • News
  • Podcast
You are here: Home » WordPress » How to Limit Post Revisions In WordPress

How to Limit Post Revisions In WordPress

By Nile Flores 26 Comments


keyboard-thumbnailIf you revise your posts a lot in WordPress, you probably are racking up quite a bit of post revisions stored in your database. With time, and as your site grows, this could weigh your database down.

In fact, you really don’t need 10 post revision, and not even 5. Usually 2 or 3 post revisions are good.

So, how do you limit post revisions in WordPress?

How to Limit Post Revisions In WordPress

Method on how to limit post revisions in WordPress for the code savvy

If you are familiar with, or not scare of editing your wp-config.php file, you can put before the code for your wp-settings.php reference toward the bottom of the file the following code snippet.

/** Define number of Post Revisions allowed in MySQL. */
define ('WP_POST_REVISIONS', 2);

For this short tutorial, I have limited the revisions to 2, but you can just change the number to what you desire.

I have seen a lot of tutorials that just have one line, but for documentation purposes, I added the line before it. This is great for those who have multiple developers who work on their website, or if you originally developed the site and left it into the site owner’s hands to figure out. It’s just common courtesy.

You can also disable post revisions:

/** Define number of Post Revisions allowed in MySQL. */
define('WP_POST_REVISIONS', false );

As you can see, the different between the previous code snippet and this one is that you have defined it as false instead of a number.

Method on how to limit post revisions in WordPress for the not so code savvy

postrevisions-screenshotIf you really donn’t want to deal with code and just want to install a plugin, Revision Control should be a good addition to your website.

I do want to note that some people have said that when upgrading WordPress and using Revision Control, you will need to reset your plugin’s limit after the upgrade so it will work properly again.

Please do note that these methods will not remove whatever post revisions you currently have. You will have to put in another method.

Have you ever had any problem with your database getting bloated with post revisions? What method do you using to limit post revisions in wordpress?


Filed Under: WordPress Tagged With: limit post revisions, wordpress tricks

About Nile Flores

Nile is a 43-year old female from the greater St. Louis (Southern Illinois side) area. Nile is a mother of 1 son. She is also a web designer and developer, a graphic designer, and a public speaker, who exclusively designs and develops using WordPress. She also blogs at GoDaddy's Blog, Verpex Hosting's blog and her very personal sites, Pixelled and Nail Polish Happy.




Related posts:

No related posts.

Reader Interactions

Comments

  1. Kesha Brown says

    June 14, 2013 at 6:40 am

    Haven’t had a problem to date but will def start adding a number to the config file as a best practice….thanks so much for the prompt!

    And yes, adding comments is always a best practice! I can’t tell you how many times it’s helped me find code a whole lot faster! 🙂

    Reply
    • Nile says

      June 14, 2013 at 6:54 am

      I am glad you have not had a problem. I have a post to clean up extra post revisions and some of it I have to actually explain why the one code we have always known is probably not the best method, while also providing the alternative method.

      I have been lax in the past about not documenting my code and after some time it just clicked that it would be a nice thing to do for other developers.

      Reply
  2. Anonymous says

    June 14, 2013 at 7:22 am

    I have lost extra revisions so i need implement it actually. Thanks for sharing

    Reply
  3. Robert Koening says

    June 14, 2013 at 2:21 pm

    Plug-ins seem to be the best option for people dealing with issues on WordPress. I think that I will utilize the plug-in so that I can avoid multiple revisions. Less headaches! Thanks!

    Reply
  4. Yorinda says

    June 14, 2013 at 8:32 pm

    Hi Niles,
    thank you for the great tutorial and the extra tips.
    Just to clarify, the revisions are each changed version of the post we write?
    So, by setting it to only keep two, does that mean it will keep the last two?
    Technology is so amazing, just a few letters of code and it is all programmed!

    Much appreciated!
    Yorinda

    Reply
  5. Jason says

    June 14, 2013 at 8:44 pm

    I didn’t even realize that this was even a problem. I am not even sure if it is even something I need to even be worrying about. If I mess it it, will I break my site?

    Reply
  6. alex says

    June 14, 2013 at 9:31 pm

    i have tryed all types of plugins for my site,none seem to work or any widgets,maybe i dont have flash or java or this,i am new so dont know a lot about websites and how they work really.

    Reply
  7. Thomas says

    June 15, 2013 at 3:38 am

    Hi Nile
    I am using a plugin called Revision Diet. It is very simple to use, but maybe I should use your code tip instead and then remove the plugin. I think I will start making a backup just in case I make some mistakes 🙂

    Reply
    • Nile says

      June 15, 2013 at 3:53 am

      Just to let you know, Revision Diet hasn’t been updated in over 2 years.

      Reply
      • Thomas says

        June 15, 2013 at 7:18 am

        That is a good point. I have tried to disable the plugin and insert the code in my wp-config.php file, but it does not work for some reason. It keeps on saving extra revision even that I have set the numbers to only 3. Do you have any ideas on how to troubleshoot this issue?

        Reply
        • Nile says

          June 16, 2013 at 4:16 am

          You will have to completely delete the plugin, but you will probably have to go and edit your database and find the table in wp_options that is controlled by the Revision Diet plugin.

          Reply
  8. Sarupa Shah says

    June 16, 2013 at 4:25 pm

    Hi Niles – my question is the same as Yorinda’s – does it only keep the lat 2 revisions or limit you to 2 revisions only if you follow your tips 😉

    Reply
    • Nile says

      June 17, 2013 at 1:11 am

      It keeps the 2 latest revisions, and discards older ones in exchange for the newer ones so you will always just keep 2 revisions.

      Reply
  9. Okto says

    June 17, 2013 at 5:12 am

    Hi Nile,
    Honestly, I never aware on risk of weigh my database. And you get me again. I’m not a tech savvy blogger :(, then the plugin link you have provided help me a lot. Going to check for it

    Thanks for the post

    Reply
  10. Debopam Banerjee says

    June 17, 2013 at 8:34 am

    Thanks for the share… I personally have not felt any problem till now…. Thanks for letting me know about the problem and be aware of the problem……

    Reply
  11. Krishna says

    June 17, 2013 at 12:53 pm

    well If we do not use the mod which you have mentioned above how many times does our WordPress blog save our post every time we revise or update? If we update a post 10 times will it create 10 copies? If at all we want to use a plugin to set post revisions what is the best available plugin for this purpose? ‘Better Delete Revision’ is used to completely remove revisions right.

    After reading this post I went to my WordPress dashboard and I opened a already published post but I could find how to revert back to previous edits. can you tell me how to do it in detail.
    thanks!!

    Reply
  12. Rohit says

    June 19, 2013 at 11:21 am

    I don’t know if there is any need of limiting post revisions at all, these revisions are like checkpoints and sometimes they are very much needed to restore a particular state of the article..,
    by the way its always been nice to know a trick, and i love that. thanks for same..:)

    Reply
    • Nile says

      June 19, 2013 at 12:52 pm

      Hi Rohit! Your site must not be very big yet or have a lot of traffic. Post revisions are often stored and depending on the length of post, 5 to 10 revisions can become quite a bit of a drag on your hosting account’s database… especially if you have quite a few articles. That is where you will want to seriously consider limiting your post revisions.

      Reply
  13. Danish Ali says

    June 23, 2013 at 6:29 am

    I have lost extra revisions so i need implement it actually. Thanks for sharing

    Reply
  14. Plaban says

    June 28, 2013 at 12:29 pm

    I don’t really want to mess with any codes so I use the Revision Control plugin. It works well and keeps my blog’s database small and compact.

    Reply
  15. Hamza Sheikh says

    July 1, 2013 at 3:11 pm

    I have used revisions feature in the past to recover, and analysis on my posts. However, this is a great tutorial on how to limit post revisions because somehow they generate lot of mess in the database. I have used several plugins to delete revisions after my initial testing.

    Reply
  16. David Merrill 101 says

    July 5, 2013 at 9:19 pm

    I was not aware that post revisions caused this sort of overload, Nile.

    These are good suggestions to minimize the problem.

    I’m not much of a tech guy, so would probably opt for the plugin. I always prefer the easy way out… lol.

    Reply
  17. Cherrie Bautista says

    July 6, 2013 at 10:17 am

    I prefer changing the code if I have specific instructions, rather than activating another plugin, though I think my database backup and optimizer plugin is already deleting post revisions every week. This is good to know, though. Thank you Niles!

    Reply
  18. vishvast says

    July 9, 2013 at 2:02 am

    i have tryed all types of plugins for my site,none seem to work or any widgets,maybe i dont have flash or java or this,i am new so dont know a lot about websites and how they work really.

    Reply
  19. Phil McDonnell says

    July 11, 2013 at 4:17 am

    Great post! I have to 100% agree with you that these revisions bog down the database after a while. For my clients I have found a great plugin that not only deletes the revisions but empties the spam/trash and optimizes the database tables as well. It can be done manually or scheduled.

    http://wordpress.org/plugins/rvg-optimize-database/

    From the codex description:
    This plugin is a ‘One Click’ WordPress Database Cleaner / Optimizer.

    Main Features
    Deletes redundant revisions of posts and pages (you optionally can keep an ‘x’-amount of the most recent revisions)
    Deletes trashed posts, pages and comments (optional)
    Deletes spammed comments (optional)
    Deletes ‘orphan postmeta items’
    Optimizes the database tables (optionally you can exclude certain tables from optimization)
    Creates a log file of the optimizations (optional)
    Optimization can be scheduled to automatically run once hourly, twice daily, once daily or once weekly at a specific time (optional)
    ‘Optimize DB (1 click)’ link in the admin bar (optional)

    Reply
  20. Samantha Vermillion says

    August 15, 2013 at 10:22 pm

    Hi,

    I never knew this actually existed. Too many post revisions for every blog post would cause unnecessary increase in the database size.

    Thanks.

    Reply

Leave a Reply Cancel reply

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

Primary Sidebar

Follow Me On:

  • Facebook
  • Instagram
  • LinkedIn
  • Twitter
  • YouTube

Get The Latest WordPress & Blogging Tips

Sign up for my newsletter, and also get my free ebook on 10 Reasons Why Your Website Isn't Converting, and How to Fix it!




Try to be More Positive on Social Media

Note: You can click on image and view the video in a larger lightbox window.

Footer

The Blog

Lots of free information, tutorials, and more to help you bring your best foot forward with your website.

  • Blogging
  • WordPress
  • Social Media
  • SEO
  • Web Design

Get The Latest WordPress & Blogging Tips

Sign up for my newsletter, and also get my free ebook on 10 Reasons Why Your Website Isn't Converting, and How to Fix it!

Copyright © 2025 · · WordPress