ECI Post Table Revision Records   

Sep 24th, 2011 // In: Easy CSV Importer, Wordpress // By: Comments 0

By default WordPress creates multiple records per post, in the posts table. I’ve seen 30 records for a single post and this is not only indicated by looking at the table or doing your own MySQL query. You can open a post in the Edit Post screen to view a list of revisions. Each revision has its own record and the records in the post table that act as revisions are indicated so. In normal use, a post won’t have many revisions and having revisions can save you losing an hour of work especially if your writing a landing page or something that requires extra effort. However when you are mass creating posts using a plugin such as Easy CSV Importer, you’ll also be mass creating revision records. Each post will have a revision record straight away. I should be clear, that not all importers work in a way that will create a revision. To have any hope of reaching the ability that ECI has, they must create a base post then update it as part of the post creation process and this is what causes a revision to be left in the database. The base post is required so that we have a post ID at the beginning of the post creation process. The post ID is used in various advanced functions that could not do what they do without having an existing post to apply to.

Preventing Revisions & Auto Save Interval

Open wp-config.php and add this line of code…

define( ‘WP_POST_REVISIONS’, false);

You can also change the automatic revision saving delay, by increasing it to lets say an hour, you will get very little revisions. Add this line to the same file…

define(‘AUTOSAVE_INTERVAL’, 600);

Clean Up MySQL wp_post Table

Run the following query…

DELETE a,b,c
FROM wp_posts a
LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id)
LEFT JOIN wp_postmeta c ON (a.ID = c.post_id)
WHERE a.post_type = 'revision'

Leave a Reply

You must be logged in to post a comment.