Wednesday morning I was playing around with this website and in particular I was working on assigning page attributes to my blog posts. The idea was to have it be /blog/postname or /posts/. While trying to achieve this I was tweaking code in the functions.php file.
What Did I Do Wrong
Before I begin with the actual recovery I want to go over what I did wrong.
- I was meddling with code that I didn’t understand. I was working in my functions.php file and if you recall I am not very good with php (maybe one of these days).
- I implemented new code without properly researching or testing. The new code ended up breaking the site if you haven’t guessed.
- Other files were effected during the crash period so that removing the bad code did not fix the site. I was locked out of the backend and couldn’t navigate the frontend.
Once the website was down it was not coming back up. I understand what I did but I am having trouble explaining why it happened.
Website Recovery Thoughts
- Since I was locked out of the backend I proceeded to PhpMyAdmin to pull my posts database file. This is a nasty way to do it but it is what I did. Insert hierarchy location here
- I confirmed my current backup solutions (i.e: XML file, Dropbox and another through my hosting company.
- I implemented my XML file into a new installation of WordPress. The new install only took a few moments to setup. As soon as I imported that document it pulled up the past 4 years worth of posts.
- My backup file was out of date by 2 months so I rebuilt the rest of my posts manually via an easy copy and paste. This process took maybe 15 minutes (5-10 posts).
- Knowing that my content was safe even if it was only the text was/is a great relief. After doing so I proceeded to download the copy from Dropbox and started to pull photos to rebuild my site. I started out with the theme-> Plugins -> Settings -> Everything else.
All in all the recovery time was less than 2 hours. Unfortunately I do not have the resources to backup every day or I could of had it done nearly instantly. The biggest time wasters were waiting for plugins to install/activate and to rebuild my latest posts. Moral of the story is if your website crashes it better be at midnight v.s during the day (or after you are on a blogging spree).
What will I do in the future
In the future I would like to have a better backup and recovery strategy. Potentially one where I didn’t have to re-setup my old plugins but there is always a point where you have to get down and dirty.
Either way: Learn from my pain and backup your website 🙂
Have a great day!
Share your website horror stories below!