How not to install wordpress themes

I made a horrible mistake earlier today when trying to change the theme on this blog. I decided that I didn’t like the mantra theme. The look just didn’t fit with being able to be read easily. So I decided that I would look around and find a theme that I liked.

How you should install wordpress themes

Under normal circumstances, you should just search for a theme using the built in theme search. This works extremely well, and I have never found a theme that didn’t work right out of the box. Simply choose your options in the admin, and hit search. Once you find what you want click the install, then activate it. You can customize it using the built in admin functions and you are off and running.

How NOT to install wordpress themes

So, I didn’t follow the above advice. I decided that I wanted a theme with all the latest and greatest things. So I did a simple search over at Google. Found a theme that looked very nice, and had all the features I wanted and best of all it was free. A quick download, then upload using the wordpress theme installer and bingo my theme was ready to activate. I clicked activate and as it was finishing my blog coughed up a 500 Internal Server Error.

For those of you that don’t know the 500 error is the worst of the error that you can receive from a website. It means that whatever is wrong, the server can’t figure it out. It is completely frustrating in wordpress specifically because if your site creates this error you can’t even do anything in the admin to fix it. As even going directly to the admin url will still give you the 500 error.

To say that I was upset is an understatement. I have spent the last couple of weeks working on this blog, getting it setup correctly, trying to advertise it a bit, etc. And now I had lost it all because of a theme change? Not how I wanted my day to go, and I definately didn’t want to lose those posts that I had spent hours writing.

How I fixed the 500 Internal Server Error

Luckily my hosting company uses a control panel to administer sites. I thought about it for a bit and realized that my posts etc were still in the database, I just could not get to them because of the error. So I uninstalled wordpress, but I left the database, directory, and media alone. That sounds a bit odd doesn’t it? What exactly did it remove? Well basically nothing other than the fact that the control panel showed the installation.

I clicked the reinstall, but wordpress doesn’t like to install over itself using the control panel. To do it you have to click an overwrite files button during the installation. You also have to choose a new database. The reason for choosing the new database is simple, it leaves all your posts in the old database. At this point I had a fresh install of wordpress, but all of my posts are gone.

 How to copy posts from wordpress database

WordPress is actually very helpful in this regard. It has several tables which control the posts, etc. In no particular order they are:

  • wp_commentmeta
  • wp_comments
  • wp_links
  • wp_postmeta
  • wp_posts
  • wp_terms
  • wp_term_relationships
  • wp_term_taxonomy

I used phpmyadmin to export each of these tables and save them to my hard drive. This gave me copies of all the tables. Then to put them in the new copy of wordpress is relatively simple. Switch to the new database, then click on the appropriate table. Choose the sql option, click the delete all rows. That gives you a clean table. Then click the import and choose the correct file for the table.

Once you have completed this for all 8 tables you have all your posts, comments, and tags, blog roll, and meta data back. Which almost completely recovers your blog. The only thing left is reinstalling and activating your plugins, and doing any other specific configuration options to make it work the way you want it to.

In conclusion

After I got the blog back I decided to make this really simple, I did a quick search using the admin theme installer and found my current theme. It’s called Graphene and I must say that it looks very clean, and for me that was the most important thing. I hope this post helps you avoid the problems that I had with installing a new theme in wordpress. I can honestly say that I won’t install another theme unless it is accessible through the admin area. Too many things can go wrong and I hate having to recover things because a third party add on breaks my wordpress.