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: The information in this article is advanced material we make available as a courtesy. Please be advised that you are responsible for properly following the procedures below. Customer Support can't assist with these topics.

  1. You should always backup your site before performing any changes.
  2. Connect to your package account with SSH
  3. Connect to MySQL using the following command:

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

    Enter the database information from your database as follows:

  4. When prompted, enter the password for that MySQL user.
  5. 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';
  6. To change the template, enter the following command

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

    Update the command as follows:

  7. To change the stylesheet, enter the following command

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

    Update the command as follows:

  8. After changing the template and stylesheet, type exit; to close out of SSH.

Warning: If your WordPress database uses custom table prefixes, then you must replace wp_ in each command with the prefix listed in your wp-config.php file.



Article ID: 1202
Created On: Tue, Nov 17, 2020 at 6:20 PM
Last Updated On: Wed, Nov 18, 2020 at 9:45 PM

Online URL: https://www.heartinternet.uk/support/article/change-a-wordpress-theme-with-ssh.html