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

 

Overview

This article provides two ways to change the theme of a WordPress site when you do not have the ability to log in.

This may be necessary if there is an issue with the current theme that potentially causes the entire site to become inaccessible. In this case, you can switch the theme using an option below.

Changing the theme

Use one of the following options to switch the theme.

Option 1 — Changing the theme in the database

This option uses phpMyAdmin to switch the theme.

  1. Log into phpMyAdmin.
  2. Click your database name in the left pane. The database tables expand.
  3. Select the _options table in the left column (the table name has a prefix but ends with "_options"). The center pane displays all rows within this table.
  4. Look for the options with the names template and stylesheet. You may need to proceed through the pages in this table to locate these.
  5. Click the pencil icon to the left of each.
  6. Change the current theme name in the text field to the theme you wish to use.
  7. Click the Go button to save your changes.

The new theme is immediately active and you should now be able to log into your site.

Option 2 — Using the command line

This option requires you to log into your server via SSH and run wp-cli commands.

  1. Log in to your server via SSH.
  2. Run the following to view a list of themes installed:
    [server]$ wp theme status
  3. Type the following to change your theme. This example switches to the default twentytwentyfive theme:
    [server]$ wp theme activate twentytwentyfive

    If a theme is not installed, you can install and activate it in one command:

    [server]$ wp theme install THEME-NAME --activate

The new theme is immediately active and you should now be able to log into your site.

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?