Brian Cook Presents

The Cookblog

Category IconHow to Recover Your Deleted Blog

September 1st, 2007 by Brian

Thanks to bad directions from the worst hosting company ever, plus my own carelessness, I deleted The Cookblog’s MySQL database yesterday. After exporting the database, deleting it, and recreating it, my attempts to import all of the tables back in met with failure due to an error. Further study showed that the export contained an error, so my copy was essentially useless. After a few choice words, I had no choice but to set about retrieving my lost posts (naturally, I hadn’t backed them up). I’m sure this has happened and will happen to others, so here’s how I went about recovering my posts with the help of Google and Wordpress.

1. First, you’ll want to find the copies of your pages that Google knows about. To do this, simply do a Google search for “site:yoursitename.com”

Google Site Search

2. For each post, get Google’s copy by clicking the “Cached” link below the search result. It’s helpful to have a browser that supports tabs for this, since there will probably be a lot of these pages to open, especially if you have a lot of posts.

Google SERP

3. Clicking the “Cached” link will take you to a page that states the date Google last saved it. It may or may not include images. Since Google won’t keep these copies around forever, it’s best to go through this process as soon as possible.

Google Cached Page

4. If you want to save the images for some reason (I still had my files intact in my FTP and they were backed up anyway), you can right-click and “Save As” to capture them. Otherwise, you’ll want to view the source code of the page. If you use Wordpress, you should be able to find the title of your post, the date it was posted and the content of the post. Select the code starting with the title and ending with the close paragraph tag. Copy it and paste it into a TXT file. Repeat steps 2, 3 and 4 for each post.

Source code

5. Once you have all of the posts you can get off Google in the TXT file, open up the Wordpress’s Write Post interface. Copy and paste in the title of the post, then switch the input field from “Visual” to “Code”. Paste in the code of your post, starting with the paragraph tag that opens the post and ending with the end paragraph tag that closes the post. This will keep your links and images intact without having to re-enter them.

WP Code Field

6. Between the title and post content in the source code is the date that you actually published the post. You can use Wordpress’s Post Timestamp option to publish the post with the initial date.

WP Timestamp

As long as Google has seen your pages and made its own copy, you should be able to recover almost all of your lost content. It only took me about an hour to retrieve and republish the 50 or so posts I’d made over the past few months. It also persuaded me to use the Manage–>Export function to save a copy of my entire blog so that if I ever delete it again, I’ll be able to reinstall Wordpress, import my saved file, and revert immediately to its previously saved state. That’s a far easier and more complete way to recover a blog, but the above method is better than nothing. Anyone else have tips/horror stories?

Tags: 16 Comments

Leave A Comment

16 responses so far ↓

  • 1 Chris Coyier Nov 7, 2007 at 9:57 pm

    Wow, that sucks. Glad you got everything back though. I’ve heard another horror story like this, and they went back to putting it back together just about this same way. Good lesson for the kids: Backup your databases!

  • 2 nick Nov 10, 2007 at 1:38 am

    I noticed there are a few post where you have escaped html tags (meaning like the stuff shows up in the text). ex http://www.thecookblog.com/what-is-a-triskelion Not sure if that’s from the recovery or not. What host do you use anyway?

  • 3 aronil Apr 27, 2008 at 7:23 pm

    Another way which i found cause i just encountered that.. TWICE in past two months.. i had subscribed to my blog through google reader and manage to have all my posts.. just that the comments are gone :( sniff

  • [...] We deleted this post (from two weeks ago) by mistake and here’s how we got it back, pictures, comments and all. Thank you for the tips, Cookblog. [...]

  • [...] used this - how to recover deleted blogs Posted under Uncategorized Comments [...]

  • 6 Ambrosiality Jun 19, 2008 at 10:50 am

    wow thanks a lot, I used your information to recover most of my blog. I think once I got to step 2 & saw my blog, I was super excited, and just copied everything, and didnt finish reading hee, luckily, most of it came true in the Rich text editor.

    bloglines also helped, it had 10 days postings, and I could email it, n the entirety, post, pictures, etc to any email.

    Thanks again!!

  • 7 anita Jun 29, 2008 at 4:16 am

    Is there *anything* you can do if you’ve made this exact mess, AND had robots.txt?

  • 8 Brian Jun 30, 2008 at 6:26 pm

    @ Ambrosiality - I’m glad it helped you!

    @ Anita - If you used your robots.txt to disallow Googlebot, you might try Yahoo. Also, your homepage might be stored on http://www.archive.org, although those are usually infrequent and incomplete snapshots of just the home pages of sites.

  • 9 shiro Jul 17, 2008 at 5:38 pm

    Thanks for sharing. Nice tips.

  • [...] This is a very tedious process and be ready to put in loads of manual effort. Brian cook has a detailed article explaining this [...]

  • [...] go to sleep, I search Google “How to recover your deleted blog” to see if there is a way to recover back a lost blog. I am not purposely lost this blog [...]

  • 12 SQ Apr 17, 2009 at 9:05 pm

    Help!! there is no cached link!

  • 13 giftedmom May 27, 2009 at 4:38 am

    i realise that my blog has been removed when my sister tried to visit it and received a message from blogger that the blog has been removed. when i log in, i could see this particular blog from my dashboard. what do i do? i’ve gone to google forum and help but none seem to be able to help me.
    I need help.

  • 14 shelly Jun 3, 2009 at 10:09 pm

    Hey! This has been helpful for me. I just figured out this past week that my blog was deleted for some reason & google could care less. So Ive been typing in post titles that I can remember…but I have had my blog for 2 years (since my baby was born) & I just cant remember everything. I still cant find every post…… any thoughts???

  • [...] would, however, like to give credit where credit is due. I used Brian Cook’s great blog recovery technique that utilizes Google’s caching feature. I had never really seen the need for this [...]

  • [...] would, however, like to give credit where credit is due. I used Brian Cook’s great blog recovery technique that utilizes Google’s caching feature. I had never really seen the need for this [...]