Deploy a local WordPress site with the UpDraftPlus (free) plugin

We know that you can easily deploy a local WordPress site to a remote server by using software like CPanel. But sometimes CPanel may not be available on the server. Additionally, imagine a scenario where you don’t have access to the FTP server or to the MySQL database (or both). In this case, if you have access only to a clean WordPress installation, you can deploy your local site with the UpDraftPlus plugin. The paid version of UpDraftPlus gives you that option out of the box. Here we’ll see how you can do the same thing (kinda) with the free version. UpDraftPlus is a popular (1M+ installations) plugin that’s used for taking backups on a WordPress site. It also gives you the ability to restore a site from the backups. What we want to do here is to backup the local site and then “restore” it at the remote server.

I want to point out here, that the database backup file that’s generated from UpDraftPlus, contains SQL commands. If something goes wrong or you misconfigure something along the way, your site may not work properly and lose access to it. I tested this method successfully on only a couple of sites. So it’s obvious that you’ll have to proceed at your own risk. I can’t help you if something goes wrong. So I suggest to first do the procedure locally (between two local sites) or do it in a remote test site to see if everything goes well.

Another thing I want to mention is that I’m using the OceanWP theme and the Elementor Page Builder plugin. If you don’t use those, you can skip the related steps. But you may have to see how your themes/plugins work and replace those steps with your own steps. To give you an example, the OceanWP theme saves the customizer settings in a .json file, not in the database like for example the Polylang plugin. Your theme or a plugin you use may do something similar. So you’ll have to check how that plugin or theme saves your settings.

We saw what we want to achieve (and the dangers) so let’s now see what we’ll have to do to make this work:

1. Install UpDraftPlus to the local site

The first thing we have to do is to install UpDraftPlus to our local WordPress site. We do that by going to Plugins - Add New inside the Dashboard’s side menu. We type “updraft” and we install/activate the UpDraftPlus plugin (it should be the first result).

2. Backup the local site

Then we go to Settings - UpDraftPlus BackUps and we press the “Backup Now” button. We check the include the database and include any files (plugins, themes, uploads, any other directories found inside wp-content) options and we press the backup now button. After a while, we’ll see at the bottom of the screen our newly created backup. The backup files are gzip archives (.gz extension) and they are saved inside the wp-content/updraft folder. They should be 5 in total (db, plugins, themes, uploads, other).

3. Backup the OceanWP theme settings

We now go to the OceanWP’s Theme Panel - Import/Export option and we export the local site’s settings. It creates a .json file that we’ll need later.

4. Install 7zip & Visual Studio Code

Now you’ll need to install 2 really popular programs if you don’t have them already on your machine. The first is the 7zip file archiver and the other is the Visual Studio Code editor. We’ll extract the backup file for the database we created earlier with 7zip and we’ll open it with Vs Code.

5. Replace the local URLs with the remote URLs

  • The file we open is not something special, just a MySQL script that recreates our local database. What we want to achieve in this step and in the following two is to replace the occurrences of our local URL in the DB file with the remote URL. Let’s assume that our local URL is http://localhost/my-local-site and our remote URL is https://myawesomesite.com. We first search, by pressing ctrl+F, for our local URL. Then, we press the arrow symbol at the left of the search box. If we do that we’ll see another input field below our search field. We type the remote address, we press “Replace All” and we save the file.
  • After we do that, we search for our local escaped URL which looks like the following: localhost\\/my-local-site. We replace it with our remote “escaped” URL. In our case is myawesomesite.com. When we’re done, we save the file.
  • Next, we check for localhost occurrences and they shouldn’t be any by now. Then we search for our local site path. If our local site is available at http://localhost/my-local-site we search for my-local-site and we replace it with… nothing. That means that we leave the replace field empty and we save the file. Note that if your local site is available on http://localhost you can skip this step.

6. Re-compress the edited db script file

After we replace all the URLs, we close the Vs Code. You can keep the old gzip db file (create a new folder and move it there) or delete it. We right click the db file we edited and from the context menu we select 7zip - Add to archive. Inside the 7zip UI, we select the gzip option in the “archive format” and press ok.

And we’re done with the local site! Let’s now move to the remote.

7. Install UpDraftPlus to remote site

We login to our remote WordPress site and we install the UpDraftPlus plugin.

8. Restore the remote site from the backup files

We go to the UpDraft settings, we select “Upload backup files” and we throw the 5 backup files we created earlier. After this is done, we should see the backup in the list at the bottom of the screen. We select restore and we check all the 5 fields. We should see a message that says “all backup files have been successfully processed” and no errors or warnings. If you see a warning that talks about “migrations” and that “you should use the migrate plugin (paid version)”, it probably means that you made an error with the URLs and you should stop here. We press “Restore” and wait until the site is successfully restored.

9. Re-configure the OceanWP theme and Elementor plugin

  • After the site is successfully restored, we go to Elementor - Tools and we click “regenerate css” and “sync library”.
  • Then we go to Theme Panel - Import/Export and we import the .json file we exported earlier with the OceanWP’s settings.

And that’s it! You’ve migrated a local WordPress site to a remote server. You did that by using only a clean WordPress installation and the UpDraftPlus plugin. If you found this helpful, please share the post link! If you broke your WordPress site, please go away.

Other things to read

Popular notes

Other posts