Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
VGSources
Blog

How to Change Your WordPress Theme From the Database

A practical, emergency-safe guide to changing WordPress’s active theme directly in the database, with phpMyAdmin steps, SQL examples, child-theme rules, troubleshooting, and rollback instructions.
Length9 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

You can switch a WordPress site’s active theme without wp-admin by changing two rows in the database. Back up the database first, open the installation’s options table, and set the template and stylesheet values to the directory slug of an installed theme. For a child theme, use the parent slug for template and the child slug for stylesheet. Verify that the corresponding folders exist under wp-content/themes, save the changes, clear caches, and test the site before making any other edits.

What the database change actually does

WordPress stores the active theme as options rather than as a single “active theme” flag. The controlling rows have option_name values of template and stylesheet. Their option_value fields contain directory slugs, such as twentytwentyfour, not necessarily the name shown in the Themes screen.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When a theme is switched normally, WordPress core’s switch_theme() function updates these pointers and performs additional theme-switch bookkeeping. Editing the two options manually changes which template and stylesheet WordPress loads, but it does not recreate every task that a dashboard switch might trigger. Theme-specific settings and content therefore need to be checked after the database edit.

Before touching the database

Make a restorable backup

Export the complete WordPress database and download the export so it is not stored only on the same server. Also record the current values of template and stylesheet. The backup is your quickest rollback if the new theme causes a fatal error, missing layout, or an unexpected login problem.

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.
  • Use your host’s database backup or export feature, or export the database with a database client.
  • Keep the original SQL file unchanged; do not overwrite it with a later export.
  • Note the site URL, database name, table prefix, and the current theme slugs.

Confirm that you have the right access

You need access to the database used by this WordPress installation. Common routes are phpMyAdmin in a hosting panel, a host-provided database console, or another MySQL-compatible client. If you cannot identify the database or do not have credentials, ask the host for database access rather than guessing.

The installation’s wp-config.php file identifies the database name and connection details through values such as DB_NAME, DB_USER, DB_PASSWORD, and DB_HOST. It also contains $table_prefix, which determines the beginning of the options table name. Treat these credentials as secrets and do not paste them into a public support forum.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Check that the target theme is installed

The database can point only to files that exist on the server. Before saving a new value, verify the target directory under wp-content/themes. For example, a folder named my-custom-theme has the slug my-custom-theme. A display name such as “My Custom Theme” is not a valid substitute unless it is also the directory name.

Check spelling, hyphens, underscores, and letter case. A one-character difference is enough to produce a missing-theme error or a broken front end.

Find the correct options table

The default table prefix is wp_, so many installations use wp_options. Administrators frequently change the prefix during installation, and some sites use a completely different value. Select the table whose name ends in _options and matches the $table_prefix value in wp-config.php.

Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed

Do not edit an options table from another site in the same database server. If several WordPress installations share a database, each one normally has a different prefix. Selecting the wrong table can leave the intended site unchanged while altering another installation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Change the theme in phpMyAdmin or another database client

1. Open the database and inspect the current values

  1. Log in to the database tool supplied by your host.
  2. Select the database named in wp-config.php.
  3. Open the table ending in _options.
  4. Filter or search the option_name column for template and stylesheet.
  5. Write down both existing option_value entries before editing.

A read-only query for a default-prefix installation is:

SELECT option_name, option_value
FROM wp_options
WHERE option_name IN ('template','stylesheet');

Replace wp_options with the real table name. The result should contain one row for each option. If it returns no rows, you may be connected to the wrong database or table, or the query may contain the wrong prefix.

2. Enter the correct slug

For a regular theme, the two values are normally identical. If the installed directory is paperpress, both rows should contain paperpress. Use the directory slug exactly as it appears on disk.

For a child theme, the values intentionally differ. template must contain the parent theme’s directory slug, while stylesheet must contain the child theme’s directory slug. If the folders are blockbase and blockbase-child, use:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)
option_name option_value Purpose
template blockbase Parent theme directory
stylesheet blockbase-child Child theme directory

Changing both rows to the child slug would make WordPress look for the parent template files in the child directory and can cause errors. Changing both to the parent slug bypasses the child theme instead.

3. Save through the table editor

In phpMyAdmin, choose Edit beside each row, replace only the option_value, and save. Do not alter option_id, option_name, autoload, or unrelated rows. Edit the two rows separately when the slugs differ.

If your client supports SQL, the generic update for a normal theme is:

UPDATE wp_options
SET option_value = 'target-theme-slug'
WHERE option_name IN ('template','stylesheet');

Replace both the table name and target-theme-slug. This statement is appropriate only when the parent and stylesheet slugs are the same. For a child theme, run separate statements:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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 afterward to confirm that the stored values are the ones you intended. The number of affected rows should normally be one for each targeted option.

Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC

4. Clear caches and test

After saving, clear any full-page cache, object cache, reverse-proxy cache, or content-delivery cache that might continue serving the old HTML. Do not delete cache tables or unrelated database data merely to force a refresh; use the cache controls provided by your host or caching plugin when available.

Open the public site in a private browser window, then test the login URL. Check the home page, a representative post, a page, an archive, search, and a 404 page. If the site uses a block theme, open the Site Editor; if it uses a classic theme, inspect the Customizer and widget screens. Test the primary menus, logo, images, forms, and any templates that are important to the site.

Switching themes when wp-admin is unavailable

Use Recovery Mode when it is offered

WordPress Recovery Mode was introduced in version 5.2. When a fatal error is detected, WordPress may send the administrator a recovery link that temporarily pauses the failing plugin or theme for that session. Follow that link if it arrives, sign in, and switch to a known-good theme from the dashboard if the interface becomes usable.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recovery Mode does not appear for every failure. Email delivery can fail, the error may occur before WordPress can generate the message, or the problem may not qualify as a recoverable fatal error. A missing or incompatible theme can also prevent normal dashboard access.

Use the database as the emergency path

If Recovery Mode is unavailable, use phpMyAdmin or another authorized database client to point the two options at a theme whose files are already present and known to work with the site’s WordPress and PHP versions. Do not select a theme merely because its name is familiar; confirm the directory exists first.

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.

Once the site loads, inspect server and PHP error logs before making additional changes. The database switch can restore rendering, but it does not repair a damaged plugin, an incompatible PHP extension, or corrupted theme files.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What changes, and what remains behind

The edit changes the active template and stylesheet pointers. It does not convert the site’s existing content to the new theme’s design. Posts, pages, media files, users, and taxonomies remain in the database, but the new theme may present them differently.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Expect differences in the following areas:

  • Customizer settings: Colors, typography, header selections, and layout settings are often stored with theme-specific keys. A new theme may ignore them.
  • Widgets and widget areas: A theme can register different sidebar and footer areas. Widgets assigned to areas that no longer exist may become inactive or require reassignment.
  • Menus: Menu assignments depend on locations registered by the active theme. The menu data remains, but location mappings may need to be set again.
  • Block templates and patterns: A block theme can supply templates and patterns that have no equivalent in a classic theme, and vice versa.
  • Theme-specific options: Theme frameworks and companion plugins may store settings that the replacement theme does not read.
  • Code in the old theme: Custom functions, shortcodes, template overrides, and tracking code placed in the previous theme can stop running. Move essential functionality to an appropriate plugin or the new theme’s supported mechanism rather than copying files blindly.

Troubleshooting common failures

Symptom Likely cause Recovery
“The theme directory does not exist” or a similar error The stored value does not match a folder under wp-content/themes. Inspect the directory name, correct the slug, and verify both rows again.
White screen or fatal error immediately after the change The selected theme is incompatible, incomplete, or missing a required dependency. Restore the previous slugs from your notes or backup, or select another installed known-good theme. Review the PHP error log.
Styles are missing but markup appears The stylesheet row points to the wrong directory, especially in a child-theme setup. Set stylesheet to the child directory and template to the parent directory, then clear caches.
The child theme is no longer active Both rows were set to the parent slug, or the parent and child values were reversed. Restore the parent slug in template and the child slug in stylesheet.
The site still shows the old design A page, object, proxy, or browser cache is serving an earlier response. Purge the relevant caches, open a private window, and verify the database values with a fresh query.
Menus or widgets disappeared from visible locations The new theme registers different locations or sidebars. Reassign existing menus and widgets in the new theme’s interface; the underlying content is not necessarily deleted.
The update affected zero rows The wrong database, prefix, table, or option name was used. Recheck DB_NAME, $table_prefix, the table ending in _options, and the exact option names.
Only some URLs fail The new theme lacks templates or relies on functionality supplied by the old theme. Test individual templates, inspect logs, and restore the previous theme if essential layouts or functions are unavailable.

How to roll back safely

If the replacement theme causes trouble, use the same database connection and restore the exact original values. For a regular theme:

UPDATE wp_options
SET option_value = 'previous-theme-slug'
WHERE option_name IN ('template','stylesheet');

For a child theme, restore the previous parent and child values in separate updates, using the backup or the notes you made before editing. Clear caches after the rollback and test the site again. If the database itself was damaged, import the untouched backup into the correct database only after confirming that you understand what other changes have occurred since the export.

Choosing the right recovery method

Method Dashboard required? Changes files? Best use Main risk
Normal Themes screen Yes No Routine switch when wp-admin works Theme-specific settings still need review
Recovery Mode Temporary recovery link and partial dashboard access No Fatal error that WordPress can isolate The recovery email or session may be unavailable
Database edit No No Emergency switch when the dashboard cannot load A wrong slug, table, or database can extend the outage
File-based intervention No Yes When database access is unavailable and files can be renamed or restored File changes can affect permissions, ownership, and more than the active-theme pointer
Hosting support No Usually no direct action by you When credentials, backups, or database expertise are unavailable Response time and available backup points vary by host

A database switch is appropriate only when the target theme is already installed and you have a current backup. If either condition is missing, obtain the missing prerequisite before editing production data.

Final verification checklist

  • Database export is stored separately and the old option values are recorded.
  • The selected table uses this site’s actual table prefix.
  • template and stylesheet contain directory slugs, not display names.
  • The target folder, and the parent folder when applicable, exist under wp-content/themes.
  • Child themes use the parent slug for template and child slug for stylesheet.
  • A follow-up query confirms the saved values.
  • Page and object caches have been cleared through their normal controls.
  • The public site, login, key templates, menus, widgets, forms, and editor or Customizer have been tested.
  • Any missing theme-specific settings or functionality has been documented before further cleanup.

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.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.