Changing WordPress Themes From the Database
Sometimes, updates made to WordPress or Plugins may break your site due to incompatibilities with your Theme. In most cases, this will prevent you from being able to access the Admin Dashboard, and the Theme will need to be updated to fix any errors. This guide will walk you through updating your WordPress Theme from the Database if you cannot access the Admin Dashboard.
- Accessing phpMyAdmin
- Setting a New Theme
- How to change the name of your WordPress site without WP Tools
These steps will vary depending on which interface your account is using. Once logged in, click the Hosting tab at the top of the account.
- Click on the cPanel sub-tab.
- Click on the phpMyAdmin icon in the database tools section.
- Click the Advanced tab from the side navigation bar to the left.
- Click on the phpMyAdmin icon in the Databases section.
Once you have opened phpMyAdmin, choose the database the WordPress site in question is using. Click the + icon next to your username to expand if you do not see a list of databases in the sidebar on the left.
- Select the wp_options table.
- Once loaded, click on the Browse tab. This allows you to browse the columns broken down into pages.
- Check the box to Show All.
- Locate the template and stylesheet settings. Click Edit.
- In the option_value setting, replace the current theme with a default theme (Twentyfifteen, Twentysixteen, etc.).
- Click Go to save when you are finished.
Once updated, your WordPress site and Admin Dashboard should be accessible.
There may come a time when you need to duplicate the content of your WordPress site and use it on a different domain name. Perhaps you are promoting a product that is known by more than one name, and you would like to have separate domains for each product name.
Instead of designing a new site for every domain, you may choose to use the content that already exists on one of your current domains. The following article will guide you through duplicating a WordPress site.
To add a new domain, go to cPanel > Addon Domains; then complete the following steps to copy files to your new domain.
- From the cPanel homepage, open File Manager.
- Open the public_html folder.
- Along the top of the screen, click Select all.
- Press and hold the Ctrl key while clicking (un-selecting) the following folders in your public_html folder:
- addon domain folder
- With the files still highlighted, click Copy in the top menu of the File Manager. A pop-up will open showing the following path: /public_html
- Type the name of the addon domain folder to which you are copying the files. This box should now look similar to: /public_html/addondomainname.com
- (Replace addondomainname.com with the actual domain.)
- Click Copy File(s).
Once the files have been copied over to your addon domain folder, in another screen, open the MySQL Database Wizard in cPanel. This is where you will need to create a new MySQL database.
To edit the wp-config.php file for WordPress:
- In cPanel, go to File Manager.
- Open the public_html folder and locate your addon domain folder.
- Right-click on the wp-config.php file and click Code Edit.
- When this page opens, edit the following information to reflect the values that were assigned to the new database that was created in the previous step.
- Click Save Changes.
Your wp-config.php file should now reflect the correct database name, database user, and database password. This is essential for WordPress to know which database to obtain the information from.
Export the database from the primary domain and import it into the newly created database. For help with this process, please refer to the following articles:
The database settings must be updated to reflect the new domain name information.
- Go into cPanel, and click on the phpMyAdmin icon.
- In the left navigation panel, click on the newly created database name.
- In the left navigation panel, click wp_options.
- Click Edit on the siteurl line.
- Change the primary domain name to the addon domain name.
- Click Go.
- Click Edit on the blogname line.
- Change the blog name to reflect your new blog, and click Go.
- Click Edit on the blog description line.
- Change the blog description to reflect your new blog, and click Go.
- In the left navigation panel, click wp_users.
- Click Edit on theuser_login line and change the user name to reflect a new login username of your choice.
- On the user_nicename line, change it there as well. For security purposes, do not use Admin as either username.
- On the user_pass line, highlight and delete the characters already in that box.
- Create a new password of your choice.
- To the left of that is the varchar(64) box; click the down arrow and select MD5.
- Click Go.
You should now be able to log in to your newly imported WordPress site.
Once the domain is working, and you can log in to the WordPress Dashboard of the new site, install the Search and Replace plugin. It will allow you to search all of the tables in the database, search for your old domain and replace each instance with your new domain. You can uninstall the plugin after the tables have been updated. In addition to the database, you should check your site for any links hard-coded into widgets, etc. Those links will need to be manually edited to reference your new site address.
- Log in to your WordPress Dashboard.
- In the left navigation menu, go to Settings.
- Click General.
- WordPress Address (URL)
- Site Address (URL)