A test environment for your WordPress site is an important part of being able to ensure smooth updates. It also allows you to test new plugins and themes without affecting visitors. However, creating an exact copy of your site in the same environment is no simple task. There are many commercial plugins and WordPress hosts who offer one click staging environments, but an easy-to-use free option has been somewhat elusive until now.
Today I’d like to take you on a tour of the new Sandbox plugin, which is now available on WordPress.org. With just two clicks, this plugin creates an exact copy of your WordPress site on your existing hosting provider. The staging environment is completely independent of your site and is hidden from visitors and search engines. The Sandbox plugin also gives you the ability to create multiple sandboxes in order to test different iterations of your site and/or its extensions.
How Sandbox Works
I tested the plugin and can confirm that it does exactly what it says it will do. Here’s how it works:
- Sandbox copies your database tables into a new set of tables with a different prefix.
- Data within the new database tables are updated to reflect the sandbox prefix
- Sandbox copies all files a new folder under the sandbox directory.
- The plugin updates the configuration file within the sandbox to support the unique sandbox database prefix
Let’s take a quick walkthrough of setting up Sandbox on a live site. Once you activate the plugin, a new Sandbox menu item is added to the admin where you can create your first test site. The plugin will warn you to backup your site before proceeding.
Next, you’ll be asked to fill in the details for your test site. Simple enough, right?
The plugin gives you updates as it is creating your test site and will confirm its success at the end of the process. This may take a few minutes, depending on how large your site is.
Once you activate your new sandbox, you’ll be navigating your test site within your browser. An alert box at the top will let you know which site you’re on and there’s a link that takes you back to your live site at any time.
Concerns and Feedback
Sandbox is not a perfect plugin, by any means, but I think it’s an excellent starting place that could develop into a solution for setting up quick test environments. My chief concern, however, is that it’s difficult to know when you’re in the sandbox, despite the notice at the top. The URL doesn’t change and your test site is virtually indistinguishable from the production site. One improvement I’d suggest is a larger, more prominent notice that makes it clear which site you’re navigating.
Additionally, if you’re actively using the plugin, it will make your backups enormous, due to all the extra tables in your database. Each sandbox you add will add its own set of tables and this can really add up when testing multiple iterations of your site. The plugin does not remove the extra tables it created within your database when you deactivate and delete it. The good thing is that you can delete the extra tables be deleting your sandboxes when you have no further use for them.
I tested a small blog site and it seemed to take a little while to set up a sandbox. This is understandable, given how much work it is doing behind the scenes. However, I have little hope of the plugin working on larger sites without timing out.
What I love about Sandbox is that you don’t have to go through the process of copying files down to a local test environment that may not perfectly match your production server. I also appreciate the fact that it’s so easy to use and has a very low barrier for entry. WordPress users who otherwise might never explore a staging environment can easily handle the setup process of the Sandbox plugin.
Stepping into your new WordPress sandbox does have a certain thrill akin to squishing your toes into sand. You know that if you break anything, it’s just sand after all. The Sandbox plugin makes it simple to test updates to your site’s plugins, themes and core. You can also use it to test plugin conflicts without turning off the lights on your production site. Simply create a new test site and go to town, disabling plugins one at a time. Testing conflicts wherein you are encouraged to disable all your plugins is much easier with a test environment that is an exact copy of your live site. The free Sandbox plugin makes it possible for WordPress users at any level to create their own staging environments.