Why would you need a WordPress staging environment?
There you will have your WordPress installment with no cache plugins. Maybe on your own server so it will be more responsive when working on editing code.
After all is said and done, you will have to move the final product from the WordPress staging address to the live domain.
You can do this manually or use a plugin. I prefer the second option and I will explain why and how it can be done.
Using a plugin to create a WordPress staging or transfer to live
This method will help you get rid of a lot of errors that you can do when moving the site manually. You may forget to do a search and replace in the database, you might miss some element in the search in replace, you will end-up with some widgets or other elements messed-up because of this. Also, there are too many steps when moving the site manually, it seems a bit too much time waste of time.
You should still know how to do it manually. In case some breaks or you must do it that way, but you can use plugins to make your life easier.
There are 2 plugins that I recommend using to create a WordPress staging to live:
- Duplicator
- All In One Migration
Both plugins are free, but they have some differences and limitations.
Duplicator
Install this plugin on your website and create a package. This will result in an archive file and an installer.php file. After that just move/upload these two files where you want to have the live version, run the installer.php and after that you just follow the instructions.
You will need:
- A database and user for it on the live environment that can be used for re-creating your database
- A server that will not timeout every 10 seconds.
You can’t move websites that have a size bigger than 1GB. (packages bigger than 1GB can’t be generated)
In this case, you will need to create the package without the Media library and all the other folders that might contain a lot of big files. Get just the important parts: DB, plugins, core files for WP (you can select that when creating the package) and remove the other by mentioning the paths.
When you run the installer.php you have the option to manually add the other file later via FTP.
The plugin works really well, the last steps lets you check the search and replace and some other advanced settings. We used it a lot without having issues. The only issues that we encountered were server related (timeout most of the times or very low memory allocation).
All In One Migration
This one has a different approach from Duplicator. You can run an export of your website. It will create a file and you can import that file in a different place to re-create your website.
The thing is: you need to have WordPress installed in the other place in order to import the file. So you will need a WP installment on the live server when you plan to move it form staging. Install the same plugin on the other WP and run an import with the file that you already have.
Everything will be deleted from the live WP and replaced with what you have in your import file. Works really well and it’s quick.
You will need:
- WordPress installment with the All In One Migration plugin
- A server that will not timeout
If the file the size is bigger than 600MB it will not work and you will need the premium version of the plugin. But you can do the same thing mentioned on Duplicator: just remove the Media library from the process of creating the import file and add it manually via FTP later.
I wanted to talk about these 2 plugins because you will need to do a lot of staging versions and move them back to live when you work as a web developer. You can’t always alter the live site for small changes, and it’s not recommended.
Of course, there are some other options that are related to the hosting service you’re using. For example, WPEngine and Siteground have WP dedicated servers and functionalities. One of the features being: staging environments. With a simple click, you are able to create a staging for your live site and revert back to live the moment you are done with the changes on the staging.
If you or your client doesn’t mind spending extra on a good hosting option for WordPress, I recommend trying/checking out the 2 mentions above.