[HOW TO] Kill dreadly revisions in WP 2.6.0

Script, MODs/hacks, phpBB 3.x.x related requests should be posted here.
They'll be answered when possible.

[HOW TO] Kill dreadly revisions in WP 2.6.0

Postby Juanm on Wednesday July 16th, 2008 18h06:12

Well, if you do a simple query into your database via phpMyAdmin

Code: Select all
SELECT *
FROM `wp_posts`


You'll be able to note that some posts aren't real posts, but revisions

You can select all revisions by typing this:
Code: Select all
SELECT *
FROM `wp_posts`
WHERE `post_type` = 'revision'


Each revision has as a parent (detailed as post_parent in the database) the original post. Please note that if you have a structure like
Code: Select all
Home » Test » post1 » post2

  • Test will have as children post1 and all Test's revisions,
  • Post1 will have as children post2 and all post1's revisions
  • Post2 will have as children only its revisions


And now, if you are interested to delete them , let's see ...

Well, it's quite simple:
  1. Code: Select all
    DELETE FROM `wp_posts`
    WHERE `post_type` = 'revision'

    will drop any existing revision into your database
  2. Code: Select all
    DELETE FROM `wp_posts`
    WHERE `post_type` = 'revision'
    AND `post_parent` = '{POST_ID}'


    will drop only revisions which have as parent {POST_ID}

    Example:
    Code: Select all
    DELETE FROM `wp_posts`
    WHERE `post_type` = 'revision'
    AND `post_parent` = '9'
    will delete all revisions of post 9
  3. Code: Select all
    DELETE FROM `wp_posts`
    WHERE `post_type` = 'revision'
    AND `post_parent` = '{POST_ID}'
    AND `post_date` = 'YYYY-MM-DD HH:mm:ss'

    will delete only the revision whose parent is {POST_ID}
    and saved on YYYY-MM-DD HH:mm:ss

    Example:
    Code: Select all
    DELETE FROM `wp_posts`
    WHERE `post_type` = 'revision'
    AND `post_parent` = '9'
    AND `post_date` = '2008-07-16 19:03:55'

    will delete the revision of post 9, saved at 19:03 and 55 seconds on July 16th, 2008

Do you want to suppress them for good?

Well ...

OPEN wp_config.php

FIND

(This is a partial match)
Code: Select all
define ('WPLANG',   
 


AFTER ADD


Code: Select all
define ('WP_POST_REVISIONS', 0); // disable posts revisions
define('AUTOSAVE_INTERVAL', 600); // In seconds  - configures the autosave interval 


Note: This won't affect WP <= 2.5.1
it's always wise doing a database backup and file backup before any manual edit. If you lose important data, you'll be on your own without backup
Juanm

Phpbb related: looking 4 a MOD? :: phpBB bugtracker :: phpBBsecurity tracker :: phpBB knowledge base

D-Off @ MobileReview wrote:who cares about WAP anymore? :)
Try google and search for content
User avatar
Juanm
Site developer
Site developer
 
Posts: 763
Joined: Thursday March 25th, 2004 21h45:21
Location: Behind YOU



Ad
Bot
 

Postby Juanm on Wednesday July 16th, 2008 22h29:32

released to the public
Juanm

Phpbb related: looking 4 a MOD? :: phpBB bugtracker :: phpBBsecurity tracker :: phpBB knowledge base

D-Off @ MobileReview wrote:who cares about WAP anymore? :)
Try google and search for content
User avatar
Juanm
Site developer
Site developer
 
Posts: 763
Joined: Thursday March 25th, 2004 21h45:21
Location: Behind YOU

Re: [HOW TO] Kill dreadly revisions in WP 2.6.0

Postby Juanm on Thursday December 25th, 2008 07h13:52

For a finer tuning on revisions you might want to take a look to this plugin : http://wordpress.org/extend/plugins/revision-control/ Have fun :)
Juanm

Phpbb related: looking 4 a MOD? :: phpBB bugtracker :: phpBBsecurity tracker :: phpBB knowledge base

D-Off @ MobileReview wrote:who cares about WAP anymore? :)
Try google and search for content
User avatar
Juanm
Site developer
Site developer
 
Posts: 763
Joined: Thursday March 25th, 2004 21h45:21
Location: Behind YOU


Return to Php and phpBB3 discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron

Rate this site