Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →If you cannot reach wp-admin, you can activate an installed WordPress theme by editing two rows in the database. Back up the database first, open the database used by the site, find its options table (usually ending in _options), and set the template and stylesheet options to the target theme’s directory slug. Confirm that the theme folder exists in wp-content/themes before saving.
Antihost offers managed WordPress hosting with free migration, one-click staging and a 14-day free trial.
What changing the theme in the database actually does
WordPress stores the active theme as two options in the site’s options table:
As an Amazon Associate I earn from qualifying purchases.
templateidentifies the parent theme directory.stylesheetidentifies the stylesheet theme directory.
For a standard theme without a child theme, both values are normally the same directory slug. For a child theme, stylesheet is the child directory and template is the parent directory. WordPress core’s switch_theme() function updates these options and performs additional theme-switch bookkeeping when a normal switch is made through WordPress.
A database edit changes which theme WordPress tries to load; it does not upload, repair or install theme files. The selected directory must already exist under wp-content/themes. A display name such as “Twenty Twenty-Four” is not necessarily the correct value. The database needs the directory slug, for example twentytwentyfour, exactly as it appears on the server.
#1 Best Overall
When a database switch is appropriate
Use this method when the public site or login is broken because of a theme or plugin error and you cannot reach the dashboard. It is an emergency activation method, not a replacement for the normal Appearance-to-Themes workflow.
Good reasons to use it
- A fatal error prevents wp-admin from loading.
- A recently activated theme causes a blank page or repeated server error.
- You need to switch to a known-good installed theme before troubleshooting further.
- Hosting support has given you database access but the dashboard is unavailable.
When to use another method first
If WordPress Recovery Mode is available, use the recovery link sent by WordPress before editing the database. Recovery Mode was introduced in WordPress 5.2 and can sometimes let you regain access after a fatal error without FTP or direct code editing. Once you can log in, switching from the dashboard is safer because WordPress runs its normal theme-switch routines.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitchesBefore editing: safety checks
Make a complete database backup
Export the entire WordPress database and retain the original file before changing anything. A database export gives you a way to restore the old option values if the site remains broken or another row is accidentally changed. Do not rely on an automatically generated backup unless you know when it was made and how to restore it.
Record the current values
Write down the existing values of template and stylesheet before editing. If the new theme fails, restoring those two values is the quickest rollback when the old theme files are still present.
Confirm the target theme files
Use your host’s file manager, SFTP, FTP or support channel to verify the exact directory name under wp-content/themes. Check that the directory contains a valid theme, including a stylesheet with a WordPress theme header. Do not point the database at a folder that was deleted, renamed or only partially uploaded.
Expect a maintenance window
Visitors may see an error, an unstyled page or a partially rendered page while caches update. If the site receives important traffic, make the change during a quiet period and keep a second browser window ready for testing.
Find the correct WordPress database and options table
- Open the site’s WordPress configuration file, usually
wp-config.php, through the host’s file manager or a secure file connection. - Read the
DB_NAMEvalue. That is the database you need to select in your database client. - Read
$table_prefix. The default prefix iswp_, but many installations use a custom prefix for security or because several sites share a database. - In the selected database, open the table whose name ends in
_options. With the default prefix it iswp_options; with a custom prefix it may look likesite7_options.
Do not assume that the first database listed by your host is the right one, and do not assume that the table is named exactly wp_options. Using the wrong database or prefix changes nothing on the live site and can lead to editing an unrelated installation.
Method 1: change the values in phpMyAdmin
The labels vary slightly between phpMyAdmin versions and hosting panels, but the operation is the same.
- Open phpMyAdmin from your hosting control panel and select the database identified in
wp-config.php. - Open the table ending in
_options. - Use the table’s search or browse function to find rows where
option_nameistemplateandstylesheet. - Choose Edit for the
templaterow and replace only itsoption_valuewith the target parent theme’s directory slug. - Edit the
stylesheetrow and replace only itsoption_valuewith the target stylesheet theme’s directory slug. - Save each row, or save the submitted changes if your interface presents both edits together.
- Clear page and object caches, then open the public site and the login page in a private browser window.
For a normal theme, enter the same slug in both rows. For a child theme, enter the parent slug in template and the child slug in stylesheet. Preserve the spelling, capitalization and hyphens used by the actual directories; WordPress theme slugs are directory names, not marketing names.
Method 2: run SQL directly
A database client with an SQL tab can perform the same update. Replace wp_options with the real options-table name before running the statement.
Free tools Windows power users keep installed
One-click scans. No signup required.
UPDATE wp_options
SET option_value = 'target-theme-slug'
WHERE option_name IN ('template', 'stylesheet');
This statement is suitable when both values should be identical. It updates only rows whose names are template or stylesheet; it does not install the theme or alter posts, pages or media.
Use separate statements for a child theme
When the parent and child slugs differ, update each row explicitly:
Rank #3
UPDATE wp_options
SET option_value = 'parent-theme-slug'
WHERE option_name = 'template';
UPDATE wp_options
SET option_value = 'child-theme-slug'
WHERE option_name = 'stylesheet';
Run a select query first if you want to verify the current rows and table prefix:
SELECT option_name, option_value
FROM wp_options
WHERE option_name IN ('template', 'stylesheet');
The result should show exactly two rows in the expected table. If it returns zero rows, stop and check the database, table prefix and option names rather than creating new rows.
How to identify the right theme slug
The slug is the folder name, not necessarily the theme’s name shown in the WordPress interface. If the server contains:
wp-content/themes/
twentytwentyfour/
newsroom-child/
newsroom/
then the standard Twenty Twenty-Four theme uses twentytwentyfour. The child theme uses stylesheet = newsroom-child and template = newsroom. A value such as Newsroom Child would be wrong unless that is literally the directory name.
Do not infer a slug from a zip filename. A zip can contain an extra top-level directory, and the extracted folder may have a different name. Verify the name on the server.
What to test immediately after saving
Open a private or uncached browser session so an old page does not make a failed switch look successful. Check the following in order:
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Rank #4
- Load the public homepage and at least one ordinary post or page.
- Open the login URL and sign in if it loads.
- Visit the dashboard and confirm that the active theme is the intended one.
- Open Appearance and inspect the theme screen, Customizer or Site Editor, depending on the theme.
- Check the primary menu, footer menu, widgets or block-based widget areas.
- Test a contact form, search, media attachment and any template used for key landing pages.
- Review the PHP error log and web-server error log for missing files, fatal errors or incompatible extensions.
Clear the page cache and object cache after the switch. A cached page can display the old design even though WordPress is using the new theme, while stale cached assets can make a working theme appear broken.
What changes and what does not
Changed by the database edit
- The active parent and stylesheet theme pointers.
- The theme WordPress attempts to load on the next request.
A direct row edit does not run every action that normally fires through the dashboard’s theme-switch process. WordPress core’s regular switch_theme() routine also performs switch-related bookkeeping.
Not automatically converted between themes
- Theme-specific Customizer settings.
- Widget assignments and widget-area definitions.
- Menu locations and theme-specific menu presentation.
- Block patterns, template parts and Site Editor settings.
- Plugin settings or code that expects the previous theme.
- Custom templates and CSS tied to the old theme.
WordPress stores much of this information, but a new theme may not declare the same locations or controls. Inspect the site rather than assuming the old layout will transfer cleanly.
Recovery when the new theme fails
Rollback using the recorded values
If the old theme directory still exists, edit template and stylesheet back to the values you recorded before the change. Clear caches and retest. This is why recording the original rows is as important as exporting the database.
Recommended Free Tools
Use a known-good installed theme
If the old theme itself is the cause of the outage, select another complete, compatible theme already present in wp-content/themes. Do not choose a directory that only contains a backup zip, a partially uploaded copy or a child theme whose parent is missing.
When database access is unavailable
Contact the hosting provider or administrator for access to the correct database. Some hosts provide phpMyAdmin; others can perform the two-row change for you after verifying ownership. Ask them to make a database backup and to confirm the exact database and table prefix before editing.
Best Value
When the database points to a missing directory
The site can remain broken if either option names a nonexistent directory. Restore valid slugs or restore the missing theme files first. A database value cannot substitute for the files themselves.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Choosing a recovery method
| Method | Dashboard required? | Files required? | Backup or rollback | Best use |
|---|---|---|---|---|
| Normal theme switch in WordPress | Yes | Target theme installed | Use a backup before major changes | The safest routine change because WordPress runs its normal switch logic |
| Recovery Mode | No ordinary dashboard access; recovery link required | Existing theme or plugin files | Follow the recovery screen and keep a database backup | Fatal errors on WordPress 5.2 and later when Recovery Mode is offered |
| phpMyAdmin row edit | No | Target theme installed | Export the database and record both old values | Emergency activation when the dashboard is inaccessible |
| SQL query | No | Target theme installed | Export the database; verify the table prefix | Repeatable or scripted changes by an administrator |
| Hosting support | No | Depends on the requested theme | Ask support to back up and document the change | No direct database credentials or uncertain database mapping |
The deciding factors are whether you can access the dashboard, whether Recovery Mode is available, whether a backup exists, and whether the target theme is installed and compatible. Database access is powerful but unforgiving: one wrong table or slug can leave the site unavailable.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Common mistakes and fixes
Entering the display name instead of the folder slug
Symptom: WordPress reports a missing theme or shows a fatal error. Fix: inspect wp-content/themes and use the exact directory name in both relevant rows.
Editing the wrong options table
Symptom: the query succeeds but the live site does not change. Fix: recheck DB_NAME and $table_prefix in wp-config.php. Multisite or multiple installations may have several similarly named tables.
Using the same value for a child theme and its parent
Symptom: the child theme’s custom styles disappear or WordPress loads only the parent. Fix: set template to the parent directory and stylesheet to the child directory.
Changing only one of the two rows
Symptom: the site loads an unexpected theme or throws missing-file errors. Fix: verify both option values as a pair and correct them together.
Forgetting caches
Symptom: different browsers show different designs. Fix: purge page and object caches, then test in a private window and check the response after the cache has rebuilt.
Expecting the new theme to preserve every layout
Symptom: menus, widgets, headers or templates are absent. Fix: map menu locations, rebuild widget or block areas and review theme-specific settings after the site is stable.
A safe, repeatable checklist
- Confirm why the dashboard is unavailable and try Recovery Mode if WordPress offers it.
- Export the complete database.
- Record the current
templateandstylesheetvalues. - Verify the target theme directory and, for a child theme, its parent directory.
- Identify
DB_NAMEand the custom table prefix fromwp-config.php. - Open the matching
_optionstable. - Update both option rows, using separate values when parent and child slugs differ.
- Confirm the saved values with a query or by reopening the rows.
- Purge caches and test the homepage, posts, login, menus, widgets and key templates.
- Keep the export and old values until the site has been stable and manually reviewed.
Final guidance
Changing template and stylesheet is the direct database-level way to point WordPress at another installed theme when normal administration is unavailable. The procedure is short, but the safeguards matter more than the SQL: back up first, use the real options table, enter directory slugs rather than display names, treat child themes as two different values, and verify that the files exist before saving. After the switch, clear caches and inspect the site’s menus, widgets, templates and theme settings because a database pointer change cannot recreate theme-specific configuration.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




