If you’ve been following along at all lately, you’ve probably seen various posts relating to the evil that had befallen this site. In particular, I had well and truly destroyed my content and had no backups available. I know I preach backups on the forums. So how could such a thing happen to me? Among other things, complacency. For the most part things are back to normal. But how did I do it? What went wrong? And for anybody else that finds themselves in this situation, what can you do? Read on my friends!
First off, what happened? Well here’s the setup. I have not liked the layout of my Mix of the Moment entries for a while. I wanted to clean that up. I also wanted to clean up the ratings system. So I hardcoded a variety of conditionals into my template to display the media player, and if the media player exists to automatically drop in the rating system. That was cool, but for the longest time I had made use of a WordPress shortcode to display my ratings. As a result of the new code, my ratings were showing up twice. I thought that looked sloppy and tried to fix it.
My idea was to just do a search and replace of the database. I tried the old standby plugin Search and Replace but it gave me a bunch of errors and didn’t work. I should have taken that as a warning, but I tried again with the Find and Replacer plugin. That one activated just fine. Now, I rely Used to rely on wp db-manager for my database backups. So of course, I ran a backup before attempting to manipulate my DB directly. Once I had the backup done, I ran the Find and Replacer.
That’s when disaster struck. I asked the plugin to find any instance of [ ratings ] (no space, I have to put them here so the shortcode doesn’t get parsed) in my content and replace it with nothing, a blank. So the plugin ran, and on any post containing that exact reference, it deleted it properly. Perfect. But on any post that didn’t have that content, it deleted any character from that query from the post. So all my posts were now missing [ r a t i n g s ]. No problem I thought, I’ll just roll back my DB that I backed up. Well, I tried and it failed. Repeatedly. So I began investigating my backups and discovered they were all the same. None of them had any information in them that was useful. They basically contained a query directing to a folder in my user/bin folder on my host. But on a shared hosting environment, I don’t have access to that folder.
That’s where I say complacency was the big problem. I had been using this plugin for 3 years. I was certain that I had verified the contents of those sql files at some point, repeatedly. I’m always thorough. Problem is, I didn’t used to be thorough. So I assumed I had verified something that back then I didn’t know how to verify. So I had no backup. I contacted GoDaddy (my host) who told me it would be $150 to do any sort of backup. Well, I frankly can’t afford $150 to get my posts back. So for the moment, I thought I was royally screwed!
I took a step back and started to think. And then it came to me! Post Revisions. WordPress has had post revisions since version 2.6 I believe. That was the solution, so I thought. It actually did help for 2/3 of the site. Basically I went in to edit my posts one by one, and rolled them back to the previous revision. That worked great on standard posts and pages. Which was great…most of my site was back. But I ran into 2 problems with this technique.
The first problem was with my older posts. I got to a point where post revisions don’t exist anymore. Prior to WordPress 2.6 I would guess. I couldn’t roll them back. And custom post type posts. It seems one of the options you have when registering your post type is to support post revisions. I had never used revisions before, so I thought there was no need to support them. Wow, that was smart.
So here is your last chance save for trying to get any posts back when all else has failed. Search engine caches. It worked for me, but it is time consuming. You can do it on Google, Bing and Yahoo. Basically, plug in the url of the post in question and search for it. When the result comes up, rather than clicking the big title, click the cache link. It’ll bring you to an older version of the post if it has been cached. I was able to copy and paste my text, then even do a ‘view source’ from in the browser to get my links back out of the code for pics and links and stuff. I think altogether the search engines were missing maybe 10 posts.
So there you have it. A last ditch recovery effort if you have truly screwed up. But avoid this. The easiest way is to make frequent backups of your database. But more importantly, verify them! Make sure you are actually backing up what you think you are. This little screwup cost me nearly a week of trouble.
thank you so much!!!! never thought to look in the cache… and ta da!!! You are a legend.
Thanks for taking the time to comment. I’m sorry you found yourself in this situation. Losing content well and truly sucks! But it sounds like you got it back, and that’s awesome! Good job! I’m glad I was able to help in any way.