How to Undo after Switch to a Broken WordPress Theme that Lead to Error 5XX.

Uploaded a customized WordPress Theme, Logged in to Wp-Admin, change the current theme to the new theme, boom! All front end and backend is now error 5XX.

Does it sounds familiar to you?  It happens quite a lot of time on me when I try to migrate my site to a new server and trying to test the old theme on the new server with a fresh WordPress setup.

It happens when your customized theme was using some plugins such as Advance Custom Fields and the plugin actually not yet installed on your new WordPress.

When you can no longer access to wp-admin, the only way to undo this is changing your theme in the database.

  1. Log in to your database using phpmyadmin, mysql workbench or just ssh to your database server;
  2. Change the “template” value in your  “wp_options” table. By default the option table is called “wp_options” but the table name prefix can be different depends on how you setup your WordPress.

    preview current setting:

    SELECT * from wp_options WHERE option_name = 'template'


    Update the table and change the theme to some default theme say “twentysixteen”:

    UPDATE wp_options SET option_value = 'twentysixteen' WHERE option_name = 'template';
  3. Do the same for ‘stylesheet’:
    UPDATE wp_options SET option_value = 'twentysixteen' WHERE option_name = 'stylesheet';
  4.  You’ve successfully undo switching a theme that breaks your WordPress.
Learn moreOptimize your WordPress for Better Performance and Security

Leave a Reply

Your email address will not be published. Required fields are marked *

4 × 2 =

FacebookTwitterInstagramPinterestLinkedInGoogle+YoutubeRedditDribbbleBehanceGithubCodePenEmailWhatsappEmail
×
facebook
Hit “Like” to follow us and stay tuned for the latest posts