WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Disable post revision (where to put code) (9 posts)

  1. Mobbin01
    Member
    Posted 3 years ago #

    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]

  2. Mark / t31os
    Moderator
    Posted 3 years ago #

    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.

  3. Mike Little
    Member
    Posted 3 years ago #

    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:

    define('WP_POST_REVISIONS',3);

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

  4. Mobbin01
    Member
    Posted 3 years ago #

    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?

  5. Mike Little
    Member
    Posted 3 years ago #

    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.

  6. Mobbin01
    Member
    Posted 3 years ago #

    The site of link that I found that info on is
    http://www.incomediary.com/15-ways-to-speed-up-wordpress/

    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...

  7. Mobbin01
    Member
    Posted 3 years ago #

    Ok, so I enter added the code:

    define('WP_POST_REVISIONS',3);

    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?

  8. PuNK DeSi
    Member
    Posted 3 years ago #

    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?

  9. Mike Little
    Member
    Posted 3 years ago #

    @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.

Topic Closed

This topic has been closed to new replies.

About this Topic