How to Manually Switch a WordPress Theme via FTP

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:

 

suicide-1

This leads to the infamous “white screen of death” as shown here:

theme-error-1

 

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:

go-to-ftp

Clicking this will allow you to create a new FTP account for your WordPress site. Fill out the form fields as shown here:

create-test-ftp-account-2

 

 

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:

ftp-details

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:

sign-into-winscp-with-ftp

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:

/wp-content/themes/

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:

rename-theme

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:

active-theme-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”.

theme-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?

Comments

  1. Thanks mahn it worked:)

    Reply

  2. Thanks, you’ve saved me

    Reply

  3. Thanks a lot, that was brilliant 😉

    Reply

  4. Saviour, if only I’d seen this first without waiting two days for assistance from the theme developers!

    Reply

  5. It didn’t work for me, I just get a white screen instead..

    Reply

    • LJ wrote: “IT didn’t work for me, I just get a white screen instead”

      Have you tried adding /wp-login.php at the end of the domain address — mysite.com/wp-login.php — in order to get to the login page?

      That worked for me.

      Reply

  6. This was EXACTLY what I was hoping to find to fix something that I had 99% ready .. I’ll just make one more tweak to that function … oh .. damn .. backup ! – oh backup was from 6 hours ago – cached copy in the browser ! . .. still broken .. ummm .. there must be a way to fix this … Google !!! –

    I will name my next child after you .. or buy you a beer, or something …

    Reply

  7. Thanks a lot it worked for me, it was brilliant

    Reply

  8. Worked a dream, so easy! Thank you!

    Reply

  9. Unfortunately it didn’t work for me. I’m guessing when I updated Themify’s Peak theme it really screwed my site over. I’ve renamed the Peak theme via FTP, I added the code snippet to make WordPress use the 2016 theme, but the dreaded white screen is still there. I can’t get into the back end either by /wp-admin or /wp-login.php

    Reply

  10. thank you so much this is exactly what i needed!!!!

    Reply

Speak Your Mind

*