2.14.1.14. Change theme in WordPress via database

Attention!

Before performing any actions, it is strongly recommended that you create backups of your site and its database so that you can restore your site to its original state if something goes wrong.

Important points:

  • Please specify only a properly functioning, installed theme and its full name. If you specify an incorrect theme name or a theme that malfunctions, the site may stop working.
  • As a general rule, you should use one of the preinstalled standard themes, if available, for example:
    • twentyfifteen
    • twentyseventeen
    • twentynineteen
  1. In the site configuration file, check the name of the database to which it is connected.
  2. Open database in phpMyAdmin.
  3. Execute the following SQL query:
    UPDATE wp_options SET option_value='new_theme_name' WHERE option_name = 'template' OR option_name = 'stylesheet';

    If the table names in the database do not begin with the standard wp_, but with a different prefix, make the appropriate changes to the SQL queries.

  4. Check the site operation.
Content