[How to]:Recover Permanently Deleted WordPress Post In 10 Steps

by Puneet Sahalot on June 5, 2010

A deleted post can be recovered from Trash. What if, the post has also been deleted form the Trash..?? A few days back, one of my posts was deleted accidently. It was an important post and writing it back was not possible as I didn’t exactly remember the content I had put. Also, the post had to be present on the blog to keep all the incoming links intact. I knew that since the post had been deleted from the Trash as well, it must not be even present in the database. Yet, I thought why not have a look at the DB once. I logged into phpMyAdmin and was able to restore the post. Now, I will tell you how I managed to get it back. Here we go. [click the images for full preview]

  1. Log in to your phpMyAdmin. Select your WordPress database. Your db will look something like this:

    db
  2. Now look for “wp_posts”. In the very next column there is an icon for “browse” click this icon to browse all your posts.

    browse-db
  3. Next, sort all the posts by Post Date in descending order. This can be done simply by clicking “post_date_gmt” once or twice. If you look carefully, you will find another column, “post_status”. This column displays whether a post has been published or drafted.

    date-sort
  4. Now, if you scroll through the list of the posts, you will also find the post which was deleted. Its “post_status” will be “inherit”. Actually, this is the post which was saved automatically during Post Revision. And this is the post which we are going to publish. Click the edit, “Pen” icon for editing the post. edit
  5. A new page will open up which looks like the image shown below. It has all the content of your post viz. title, excerpt, content, date, time, author, category, status etc. We do not require all these details. We will make changes only to: ID, post_status, post_name, guid and post_type.

    page
  6. First of all check the value for post_parent, it will be a numeric value. Clear the ID field and copy the post_parent value to ID.id-parent
  7. Next, change the post status from “inherit” to “publish”.
  8. title-status

  9. Now, change the post name to the way it appears in URL. I use post-title in my URL. For eg. flockpost.com/twitter-might-introduce-new-feature-you-both-follow/. Here the title of my post is [Twitter Might Introduce New Feature “You Both Follow”]. Remember to remove all the symbols and replace blank spaces with a ‘-‘ sign.
  10. title-status

  11. Now, look for post_type, you will find it at the bottom of the page. Change it to “post” from “revision”.post-type
  12. Now, comes the final step. Look for “guid” this field contains link to your post / post address. It will look like: http://yourdomain.com/2995-revision-3. But we do not want this. We want the link which would link to the original post which has been deleted. This is very important to keep incoming links intact. Here, simply replace “/2995-revision-3” with “/?p=2995”, where “2995” is nothing but the post ID which we changed in step 6.guid

That’s it..!!! You have successfully recovered your deleted post and also all your incoming links are back in action.

If you liked the post don’t forget to share it on your Facebook profile or re-tweet it.

More Interesting Stories

{ 4 comments }

tricks tips July 24, 2010 at 7:49 am

wow…very nice post bro…

Once i suffered because of this when i was a new blogger……

puneetsahalot July 28, 2010 at 10:09 pm

this is the way everyone learns :)

fulano August 4, 2010 at 7:08 am

This post saved my life! Thank you!

puneetsahalot August 8, 2010 at 4:38 pm

happy to hear that it helped you :)

{ 1 trackback }

blog comments powered by Disqus

Previous post:

Next post: