1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Remove WP Revisions

Discussion in 'WordPress' started by eDailylife, Apr 30, 2013.

  1. #1
    Please let me know clearly how I can remove WP revisions
     
    eDailylife, Apr 30, 2013 IP
  2. Devtard

    Devtard Notable Member

    Messages:
    850
    Likes Received:
    133
    Best Answers:
    4
    Trophy Points:
    220
    #2
    Run this SQL command to delete all revisions:
    DELETE FROM wp_posts WHERE post_type = "revision";
    Code (markup):
    Put this code into your file wp-config.php in order to prevent revisions from being created in the future:
    define('WP_POST_REVISIONS', false);
    Code (markup):
     
    Devtard, Apr 30, 2013 IP
    ryan_uk and flowersn like this.
  3. iteamweb

    iteamweb Active Member

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #3
    Better to use plugin for removal instead of sql query.
    http://wordpress.org/extend/plugins/revision-removal/
     
    iteamweb, May 2, 2013 IP
  4. Arick unirow

    Arick unirow Acclaimed Member

    Messages:
    719
    Likes Received:
    298
    Best Answers:
    30
    Trophy Points:
    500
    #4
    I prefer doing the devtard method as it is easy and require no additional plugins (I believe less plugins is better).
    However, using plugin is recommended as it hassle free, has lots of features and almost everyone can do it.
    For OP. deleting revision is good to keep database smaller and faster to access but i recommend to delete only old revision and allow new revision to be created. Or better, only keep future revision but limit it it just one.
    Deleting spam comment also decrease the database size.
    Choose whatever the best for you and it would be great if you keep inform us on what you have done to solve your problem.

    Arick.
     
    Arick unirow, May 2, 2013 IP
    ryan_uk likes this.
  5. samirbalwani

    samirbalwani Greenhorn

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    21
    #5
    Also, once you remove all the revisions, in your wp-config add the line below. It allows you to set a total number of revisions you want to keep, so you can still use the functionality without overloading your database:

    define('WP_POST_REVISIONS', 3);
     
    samirbalwani, May 15, 2013 IP
  6. mizaks

    mizaks Well-Known Member

    Messages:
    2,066
    Likes Received:
    126
    Best Answers:
    0
    Trophy Points:
    135
    #6
    Get a plugin like WP-Optimize. It will remove revisions, auto-drafts, clear SPAM and keep your database tables optimized.
     
    mizaks, Jun 4, 2013 IP
  7. robaid

    robaid Member

    Messages:
    126
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    35
    #7
    Devtard was right with his advice if you plan to delete the existing ones and turn them off (which helps a lot when your website gets bigger), samir's code limits revisions to 3.
     
    robaid, Jun 9, 2013 IP