If you’re staring at a broken WordPress theme and can’t even access your administration dashboard, don’t panic! This step by step tutorial will show you how to switch to another theme manually using FTP.
But first, let me break my theme:
Breaking WordPress – it’s Easy!
WordPress can be incredibly fragile at times. In the screenshot below for example, I just navigate to my theme’s functions.php file and add a <?php line at the bottom without closing the opening tag. Like this:
This leads to the infamous “white screen of death” as shown here:
This screen can be triggered in many, many ways. Parsing errors, duplicated functions from a plugin, and lots of other vague theme or plugin related reasons. Sometimes it’s possible to just run to the admin and change the theme. But many times, the admin itself is compromised. To manually switch a WordPress theme, FTP is a great tool to use.
Step 1: Get an FTP Account for your WordPress Site
If you already have an FTP account, proceed to step 2. If not, open up your hosting control panel and navigate to the FTP icon:
Clicking this will allow you to create a new FTP account for your WordPress site. Fill out the form fields as shown here:
The important things to note are the “Directory” in which the FTP account will start. Make sure this path points to your main WordPress directory containing the folders “wp-includes”, “wp-content” etc etc. Fill out your username and passwords and click “Create FTP Account”. Once your account is created, it will be added to the list below. Next to your account in the list, click “Configure FTP Client” so you get the details to use:
Now that you have FTP access, you need a client to access your site. Personally, I like to use WinSCP. It’s free, and has a simple interface. After installation, fill out the FTP details you got from the first step as shown here:
In the “Host name” section, type in the name you got from “FTP Server” in the previous screenshot. And add your username and password as usual. If all goes well, it should connect and you have now accessed your site via FTP!
Step 2: Manually Switch the WordPress Theme
Now it’s time to change your WordPress theme. If your FTP client has opened in your WordPress folder, navigate to the following location:
This will show you a list of all themes currently installed on WordPress – each has its own folder. Right click the name of the theme that’s breaking WordPress and rename it to something else as shown here:
Once done, simply visit your WordPress dashboard. It should be working. Navigate to “Appearance”, and WordPress will show you a message saying that it’s reverting to the default theme because the active one is broken:
In this case, the “default theme” is likely TwentySixteen, or one of the others that came pre-installed with WordPress. Now your site will work again, but with another theme. In the meanwhile, you can try and fix what went wrong in the first place without the added pressure of a broken site.
In case you’re wondering what happens if we rename the default theme, WordPress will then simply shift to the next “default” theme. And when it runs out of those, it displays an error message saying: “The theme directory “xxx” does not exist”.
This is just to satisfy your curiosity about what happens when all the valid themes in the WordPress theme folder are renamed!
In the future, if you want to quickly switch WordPress themes manually, you can make use of this code snippet I developed, so that you can recover from a broken theme or plugin instantly. It’s always good to be prepared right?