Changing Theme in WordPress Through the Database


Before proceeding, it is strongly recommended create backups of the site and its database in order to be able to return the site to its original state if something suddenly goes wrong.

Important points:

  • Indicate only a correctly working installed theme and its full name. If you enter an incorrect theme name or a theme that is malfunctioning, the site may stop working.
  • As a rule, you should use one of the predefined default themes, if any, for example:
    • twentyfifteen
    • twentyseventeen
    • twentynineteen
  1. In the site config file takealook the name of the database to which it is connected.
  2. Openup database in phpMyAdmin.
  3. Execute the following SQL query:
    UPDATE wp_options SET option_value='name_новой_themes' WHERE option_name = 'template' OR option_name = 'stylesheet';

    If the names of the tables in the database do not start with the standard wp_, and with a different prefix, make the appropriate changes to the SQL queries.

  4. Check the site is working.