Skip to main content.
March 29th, 2007

WordPress Post mangling – quick change to keep 2 past revs of a post

I had been working really hard on my post on our super duper mail server and at some point I started having some really weird interactions with the tinymce editor. I was switching back and forth between the raw HTML editor and all of a sudden I only had the middle 60% of my post. Stupidly I hit Save and lost a good chunk of my valuable words of wisdom. I was able to recover most of the text from the original email, but I was a bit perturbed there wasn’t a revert feature.

So, I added one:

ALTER TABLE `posts` ADD `post_content_bkp1` LONGTEXT AFTER `post_content` ,
ADD `post_content_bkp2` LONGTEXT AFTER `post_content_bkp1` ;

or actually two revisions.

I then altered the sql for updating posts like so:

post_content_bkp2 = post_content_bkp1,
post_content_bkp1 =

so, there may not be any interface for this, but at least if I or the software mangles a post while I’m editing, I should be able to go to the db and recover something.

Posted by Brian Blood in Database, General, Web Software

1 Comment »

This entry was posted on Thursday, March 29th, 2007 at 12:39 am and is filed under Database, General, Web Software. You can follow any responses to this entry through the comments RSS 2.0 feed. You can leave a response, or trackback from your own site.

One Response to “WordPress Post mangling – quick change to keep 2 past revs of a post”

  1. Writing blog posts and email using online editors is a bad idea. » JoeBlog says:

    [...] recover the last 2 revisions of a post. It wont help me in this case but I’ll implement his method for preventing the problem in the [...]

Leave a Reply

You must be logged in to post a comment.