GoDaddy Help

Change a WordPress theme with SSH

You can change the currently active theme from within SSH. This is a more advanced method, but can be more efficient for developers who manage multiple WordPress sites.

Warning: You should always back up your site before performing any changes.
Note: If your WordPress database uses custom table prefixes, you will have to replace the prefix wp_ in commands under 5 and 6 with the prefix listed in your wp-config.php file. You should prepare this information before you connect with SSH to avoid being disconnected while looking for it.
  1. Connect through SSH using the steps for your hosting plan.
  2. Connect to MySQL using the following command:

    mysql -h host -P port -u username -p database 

    Enter the database information from your database as follows:

    • host is your database hostname or IP address.
    • port is the port MySQL is running on (by default this is 3306).
    • username is your database username.
    • database is your database name.
  3. When prompted, enter the password for that MySQL user.
  4. Once connected, enter the following command to check your current theme and child theme:

    select * from wp_options where option_name = 'template' or option_name = 'stylesheet';
  5. To change the template, enter the following command:

    update wp_options set option_value = 'themeName' where option_name = 'template';

    Update the command as follows:

    • themeName is the name of the new theme.
  6. To change the stylesheet, enter the following command:

    update wp_options set option_value = 'themeName2' where option_name = 'stylesheet';

    Update the command as follows:

    • themeName2 is the name of the new theme or child theme.
  7. After changing the template and stylesheet, type exit; to close out of SSH.

More info