Knowledgebase

How To Safely Change The WordPress Theme On Your Website Print

  • 0

On the surface, changing a theme, might seem harmless. It’s so easy, it’s hard to imagine it can do any harm. You can even do it from within the dashboard these days, without any manual FTP upload required. It’s quick, painless and perfectly safe, right? Depends on how you’ve set up your site.

The thing about WordPress sites is that they often become more of a mosaic, puzzle, or even, a jenga tower, than a painting or statue carved from a single block of marble. You have all the plugins and the theme, and any small or major edits you might have done, coming together to create a beautiful functional site that suits your needs.

And that’s why it’s important to be careful when you change your theme (or even update WordPress on your site for that matter) because if you pull out the wrong piece, the whole structure might collapse. And then you’ll end up having to go through a long(and with some webhosts, costly) retrieval process, or end up having to replace many of the plugins you’ve grown to know and love.

But, there is a way you can make changing the theme a 0% risk endeavor, and luckily, it’s covered in detail below. Let’s get started!

Step 1. Select A New WordPress Theme

If you haven’t already, find a new theme you love. If you’re not a developer, try to find a theme that looks more or less how you want it to. A great place to look for premium themes isThemeforest. Here you’ll find lots of WordPress themes that have plenty of color options, added features, and even drag & drop page builders (like our Total WordPress Theme) to make it easy for even non-coders to customize their WordPress theme. Of course if your budget doesn’t allow for a premium theme, have a look at our WPExplorer Free WordPress Themes or atWordPress.org’s massive repository where new free themes are added all the time.

themes-directory

When selecting a new theme it’s important to make sure that your new theme supports the plugins you deem necessary. If you’ve built an entire store with WooCommerce, you’ll probably want to continue using WooCommerce with your new theme so just double check plugin compatibility and main theme features before committing. Of course, if you’re a developer you don’t have to worry about finding the “perfect” theme since you probably have the knowledge to create or customize a theme yourself. Once you find a theme that meets your needs, move on to step two.

Step 2. Create A Backup Of Your WordPress Site

It’s a good idea to make a current backup of your WordPress website before changing your theme, and there are quite a few ways to go about it. In this post we’re going to focus on two different methods: using backup plugins, and backing up your WordPress site manually. Both are fairly easy processes (even for new users).

Method 1: Using A Plugin To Backup WordPress

First off, we’ll learn how to use backup plugins. They mostly work in the same way, through the WordPress scheduler, and most have been reported to have difficulties with larger sites. So if you have a very large website, then the manual process (described below) is probably a better option for taking regular backups of your site. But if you just want a quick export of your WordPress site solely for the purpose of testing a new theme, then a plugin should be just fine for big and small websites alike. The biggest benefit of having a plugin do your backups, is that you don’t have to worry about it.

Here at WPExplorer we recommend BackupBuddy, but I’ve also included the standout free alternative that is Updraft Plus. Updraft not only backs up your site, but uploads it to multiple locations “in the cloud”, all with a single click. And it also lets you to do a simple 1 click restore if something has gone horribly wrong.

(While the majority of the reviews are success stories, there are some horror stories in there as well. So if the website is a big part of how you make your income, or incredibly important to you in other ways, you would do good to make a manual backup as well every now and again.)

Method 2: Manually Backup WordPress

While backing up your WordPress site manually might seem like a big, complicated, even, overwhelming task to a newer user, it’s really quite straight forward.

#1 Log into your webhosts control panel for your site (whether that’s cPanel or something else.)
Most webhosts have the option to either log into your account, or into the control panel through their website, so go to your webhosts site and log in.

#2 Find FTP login information, or create a new account.
To do this, click one of the options inside the control panel menu that says something like “FTP users/accounts” or “FTP access” or “FTP settings”. If you don’t see any users, or you don’t know the password, you can quickly create a new user by clicking “add new user”, then creating one.

ftpaccount

#3 Login, and copy all relevant files from the right directory.
Now, at this point many people would advise you to get an FTP client like FileZilla, but you can actually access your site through ftp with your web browser, or even good old Windows Explorer (or finder/nautilus if you don’t use Windows).

ftpadress

To do this, simply type “ftp://yoursite.com” into explorer, or the other one, and log in with information you found, or the user you just created. I like to use my file browser because it makes backing up as easy as copying and pasting into the desired location, then making the folder into a zip archive.

ftpcopy

#4 Go back to the control panel, and open up phpMyAdmin.
For many control panels this involves a fair bit of scrolling downwards (look for the logo pictured below).

PhpMyAdmin_logo

#5 Choose the right database.
If you have a lot of WordPress sites running on the same hosting, that will mean a lot of databases showing in the same phpMyAdmin, so you need to check that you’re choosing the right table to back up. One way of doing that, is simply going into the databases and checking what’s written in the posts under the “wp_posts” section.

admin

Another way to find out, is by checking your wp-config.php file on the relevant site, either through the WordPress Dashboard, or by opening the backup copy of the file in a text editor. (Be careful not to edit it.) Simply search for ‘db_name’ and you’ll find it instantly.

#6 Export the database
Simply click custom, and select the right database when choosing which one to export, scroll past the other custom options, and click go. It’s exactly as simple as it sounds. Another piece of good news is that it’s just as easy to import a table in case something goes wrong… and you already know how to do it!

exportdatabase

Step 3. Clone Your Website For Testing

There are two easy ways to clone your website for testing, either by using a staging site that comes with your hosting plan, or by setting up a local server.

Cloning Your WordPress Website To A Staging Site

Many WordPress hosting plans include access to one-click staging such as GoDaddy andWPEngine. These are great options since they’re online, so you can login to test the theme on various devices (something you can’t do with your localhost since it’s confined to your computer).

If you’re using WPEngine this process is extremely simple (as it is with most hosts). All you have to do is log into the WordPress website you want to duplicate, click on the WPEngine menu item at the top of your dashboard, click on the staging tab and the click the big blue button to “Copy site from LIVE to STAGING.” And that’s it (another reason why we love WPEngine so much).

wpengine-staging

Cloning Your WordPress Website To A LocalHost

But setting up a localhost is also a great option, since a local version is accessible even without an internet connection (making it extra useful). And just like backing up your website, you can either use a plugin to help or manually clone your website.

Method 1: Using A Plugin To Clone Your WordPress Site

#1 Install local server software & WordPress.
You can choose from XAMPP, AMPPS, WAMP, MAMP and others. What this software does, is recreate the environment of a webserver on your very own computer. Not only does this allow you to test new themes, plugins, and WordPress updates out on your WordPress site. It allows you to make completely ready-to-post drafts in WordPress, when you don’t have an internet connection. Remember to activate Apache and mySQL after installation is complete. Once your localhost is ready, you’ll also need to install WordPress locally.

#2 Install plugin on original site and export.
As an example, we’re going to be using All-in-one-migrate here. But you can use any plugin that you prefer. Among the other free plugins, Duplicator seems to be the most raved about. Simply add and activate your plugin of choice, and then export your website accordingly.

export

#3 Install plugin on local hosted WordPress and import.
This is fairly straight forward. Log into your locally hosted WordPress site, install and activate the plugin, then import.

import

#4 Wait and enjoy your new clone.
Wait a while as the plugin imports the copy of your site (this can take a quite a while, depending on the size of your site). Then open it up and enjoy once it’s finished. It’s that easy.

Method 2: Manually Cloning Your WordPress Site

#1 Prepare your local server or staging site.
Whether you’re using a plugin or not, this step is still the same. You will still have to setup your localhost and install WordPress locally.

#2 Copy and paste backup copy of WordPress
If you plan on creating the local clone manually (and you’re already halfway there) you just need to copy and paste the backup copy of the files you took earlier into the appropriate folder ( ampps/www/ folder if using AMPPS, or the mamp/htdocs if you’re using MAMP). Make sure to place the files in a separate folder, to avoid trouble with the ‘server simulator’ software (should be placed in for example ampps/www/wpclone/ if using AMPPS). If you didn’t take a manual backup copy already, follow the steps laid out above.

#3 Open up phpMyAdmin and import the database.
Open up the local server dashboard, and then open up phpMyAdmin (if you’re using AMPPS you could also simply enter ‘localhost/phpmyadmin’ into your web browser instead). Click import, and then select the sql backup file you saved earlier, during the manual backup (again, if you didn’t do the manual backup, follow the steps listed above).

sqlimport

#4 Find correct database user/password info and create a user in phpMyAdmin.
First, open up your backed up wp-config.php file in a text editor, like notepad, and search for DB_USER and DB_PASSWORD. Then take those values (located where I blacked out), and make a new user with that username and password by going to databases in phpMyAdmin, and then clicking check privileges next to the right database,then finally clicking add user.

checkprivilege

#5 Replace Some Urls
So your new local site doesn’t go crazy thinking it’s located somewhere else, you need to edit two fields in the database: siteurl and home, under wp_options (if it’s only displaying 25 rows per page, home will be shown on the 2nd page). Edit them to https://localhost/wp or whatever you chose to name your folder, and your cloned site will be ready to use.

siteurl

Step 4. Testing & Troubleshooting Your WordPress Theme On Your Clone Site

This is as easy as logging into the admin area on your local clone or staging site, installing and activating the theme, and seeing what happens. All of these steps are not required, they are just some of the many theme features you might want to test if you switched themes.

Enable wp_debug
This is a great way to test if there are any errors in your theme. To enable wp_debug , open up your wp-config.php file and set wp_debug to true, like so:

1 define('WP_DEBUG', true);

This will show all of your php errors and notices on the front end of your WordPress site. Keep in mind that not every notice displayed will break your site, but it’s still a good idea to fix them.

wp-debug-error

Custom Post Types
If your old theme used one or more built-in custom post types and your new theme doesn’t have theme it may look like you lost all your content. But don’t worry, it’s still in your database. You can use a third party plugin, like Easy Content Types WordPress Plugin by Pippins Plugins, to register your old custom post types in your new theme. If you aren’t sure what the names of your custom post types are you can ask the old theme developer, or search the old theme for the register_post_type function and locate the names of your old custom post types.

Widgets
It’s a good idea to look over the widget options, ad spots, footer columns and the sidebar width in addition to any other widget ready areas. This way there are no surprises later.

Menus
Double check the menu locations and formats in your new theme. Perhaps there are more menu locations, or a vertical navigation. Just look the theme over so you know where all of your menus will be when you activate the theme on your live site.

Post Formats
A lot of themes use custom fields, so if you’re using one to define a specific video/audio/gallery/etc you might have to alter the output of your post formats in your new theme via child theme so you can continue using the old meta on old posts, or you might be able to use the add_post_meta( )

Plugins
We mentioned before that if you’re not a developer you should find a new theme that’s compatible with all of your required WordPress plugins. Just to be sure it’s a good idea to test your plugins to make sure they really do work with your theme. And if you are a developer who has created or customized a theme, now is also a good time to make sure that your tweaks haven’t effected your plugin compatibility.

Check Browser Console
Open up your browser to check for javascript errors. If some things aren’t working correctly (javascript related), such as sliders, drop-down menus, carousels, etc. you can check the browser console for errors. Just open your console to see your javascript errors, and hover on them to see exactly where the error is located.

console-error

Here are links to where you’ll find your console for various browsers:

Check Featured Image Sizes
You might have to upload or tweak your featured images when you switch over to your new theme. The easiest way we’ve found is to use the free Image Cleanup WordPress plugin. The plugin indexes all of your cropped and unused image sizes which you can delete to more to a new folder. Easy peasy. Once you’ve cleaned house, you’ll want to re-crop all of your images with their correct dimensions. Some themes like Total crop images dynamically, so you don’t have to do anything. But, if you theme doesn’t do this for you, use the Regenerate Thumbnails WordPress Plugin to regenerate all your images in the proper sizes.

SEO Check
Unfortunately there are themes with built-in SEO options, and if you are currently using them you most likely will not be able to carry them over to your new theme. Instead you should install an SEO plugin on your live site and fill out the options before updating

Mobile/Browser Testing
If you chose to create an online staging site via your WordPress host then you have the option to do some real mobile testing of your own. Grab your tablet and phone to see how your new theme looks. Or, if you chose to install your new theme on your local host, you can try an online responsive simulator like the Responsinator or Cross Browser Testing.

Once you’ve confirmed that there are no issues by visiting posts, pages, and checking that everything works, it’s time to move on to the final step.

Step 5. Install & Activate Your New WordPress Theme On Your Live Site

Now that you’ve thoroughly tested your new WordPress theme, login to your WordPress dashboard install it on your live site. Before you activate the theme just do a quick double check using the Live Preview option. You can use this to click through a few of your pages just to be sure that everything looks good.

preview-theme

An optional step would be to install a coming soon plugin on your site before activating your new theme. This way if you have to make any tweaks to your live site after activating your new theme, your visitors will see a pretty under construction or coming soon page. Two plugins we really like are the Authentic Coming Soon WordPress Plugin and the Ultimate Coming Soon Page WordPress Plugin.

Once you’re ready to go, simply navigate to Appearance > Themes and click the button to “Activate” your new WordPress theme


Was this answer helpful?
Back