Support » Plugins » Hacks » Disable post revision (where to put code)

  • Resolved Mobbin01


    I have had good success previously putting code into my .php files to add or disable different functions, but when I tried to put the following code into my wp-config.php file, it nearly brought down my site.

    <?php define(‘WP_POST_REVISIONS’,false); ?>

    is the exact code I inserted into wp-config.php symbol for symbol. I am guessing that I put it in the wrong place and did something horrible. The code is meant to disable post revisions and speed up your WP site.

    Can anyone tell me where I should put this code exactly for it to work correctly? ( I think before I just put it at the end of everything) Here is my wp-config.php file code, appologies that it makes this post extra long…

    [Code moderated as per the Forum Rules. Please use the pastebin]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Add the code without the PHP tags.. the config file is already written inside PHP tags, so you end up nesting PHP tags inside PHP tags, which of course would be incorrect and will naturally fudge up the config file.

    Also worth noting that removing revisions does not speed up your site.

    The queries that fetch data to display on your site ignore revision anyway, so they have no impact on the speed.

    They will take up some space in your database, but that doesn’t impact your display speed.

    Also, if you want to keep some advantage of revisions, but still control the database space used, set it to a number. e.g:


    will only ever save a maximum of three revisions per post, after that the oldest one gets deleted when a new one is saved.

    Duh…yea, I totally understand what I did then. Thank you for the reply and the useful info. But yea, I was under the impression that this code would speed up my blog, since I found the code in and article specifically related to speeding up your blog.

    Do you have any code off the top of your head that I should add, or anyone, should add to their blog to speed it up?

    That wouldn’t be the wpmudev article would it? If so, I’ve commented twice now to try to correct some of the inaccuracies on there.

    Unfortunately, many people wrongly think more data must mean slower, but that’s usually not true with a database that has appropriate indexes, and a system that uses well optimised queries.

    The first thing you should do to speed up your blog is to install one of the popular caching plugins, wp super-cache or w3 total cache are to I would recommend.

    Note: that by default neither of these will served cached pages for logged in users (ie.e you) so you won’t see an immediate improvement whilst your are logged in. but your visitors will.

    The site of link that I found that info on is

    The guy who runs the site gets a lot of traffic so it is a little ominous that he giving out accurate information. I guess in the end it is all good stuff to know, but still.

    I actually have w3 total cache, its good however I had to disable the Java script minify settings, and I have not been able to quite understand or configure the CDN…

    Ok, so I enter added the code:


    to my wp-config.php file and it doesnt seem to have changed anything. When I go into edit my page or blog posts it still shows a long list of page revisions…

    Am I missing something?

    same here

    i want to completely turn off revisions
    tried both options added these lines in config

    define('WP_POST_REVISIONS', false);
    define('WP_POST_REVISIONS', 0);

    But Revisions still there 🙁

    If there is some specific location to place code in wp-config.php?

    @mobbin01 Yes that article is completely wrong about revisions causing your site to slow down. As it is wrong about removing calls to bloginfo, and optimizing your database.

    @mobbin01 and ades_ting

    Setting define('WP_POST_REVISIONS', 0) does not change the existing revisions in your database.

    But the next time you make a change to a post with more than three revisions it will throw the oldest ones away until you are left with three.

    Any new posts you create will only ever have a maximum of the three latest revisions.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Disable post revision (where to put code)’ is closed to new replies.