Changing the theme when you do not have access to the site

Overview

When the current theme breaks or has a problem, it can make the entire site inaccessible with errors. This makes it hard to switch to a working theme because even the admin panel won't load.

There are two ways to change the theme when you don't have the ability to log into your site:

  • Using the command line
  • Changing the theme in the database (using phpMyAdmin)

Using the command line

  1. Connect to your server via SSH and use the WordPress command line tool.
  2. Type the following to view a list of all available themes:
    [server]$ wp theme status
  3. Type the following to change your theme:
    [server]$ wp theme activate twentytwenty
  4. If you don't have twentytwenty, install and activate it in one command:
    [server]$ wp theme install twentytwenty --activate

Changing the theme in the database

To switch to a different theme using the database:

  1. Log into phpMyAdmin.
  2. Click your database name on the left.
  3. Find the _options table in the left column (the table name has a prefix but ends with "_options")
  4. Go to the second page and look for the options with the names template and stylesheet.
  5. Click the pencil icon to the left of each.
  6. Change the current theme name in the text field to any theme you wish your site to use.
  7. Click the Go button when finished to save your changes.

Troubleshooting

If you see an error when running any of the commands above, please contact support for further assistance.

See also

Did this article answer your questions?

Article last updated PST.

Still not finding what you're looking for?