- 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:
- Code: Select all
DELETE FROM `wp_posts`
WHERE `post_type` = 'revision'
will drop any existing revision into your database- 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'
- 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

