Sandbox Plugin Creates a WordPress Test Environment in Two Clicks

photo credit: Blixt A. - cc
photo credit: Blixt A.cc

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:

  1. Sandbox copies your database tables into a new set of tables with a different prefix.
  2. Data within the new database tables are updated to reflect the sandbox prefix
  3. Sandbox copies all files a new folder under the sandbox directory.
  4. 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.

add-new-sandbox

Next, you’ll be asked to fill in the details for your test site. Simple enough, right?

create-sandbox

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.

creating-sandbox

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.

medium_2715060136Stepping 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.

19 Comments


  1. It all sounded great until:

    “Additionally, if you’re actively using the plugin, it will make your backups enormous, due to all the extra tables in your database.”

    I test out plugins and new themes on a local setup using XAMPP

    Only takes a few minutes to set up a new WordPress install and no problem if it all goes wrong.

    Report


    1. Do you find it easy to create an exact clone of your server environment, database and files on your local test site?

      Report


      1. I’ve only tried to create a clone once by downloading the database and replacing the URLs with the local URL and it was fairly successful.

        Do you have any suggestions on how to do it more efficiently Sarah?

        Report


      2. I guess that’s the point of this plugin ;) No downloading anything or replacing URLS. It instantly duplicates your entire setup so you can test things. You can always delete your sandbox when finished, if you’re worried about large backups.

        Report


      3. This is an amazing plugin – possibly the most useful in creating a site. The backup issue is not important since you should not be keeping your sandbox, only use it when you need it, especially since some of the security plugins get strange in the sandbox, so I turn those off for testing. When you are ready, delete the sandbox, and drop the tables from you DB – all easy to do!

        Report


  2. I installed & activated Sandbox on my localhost WAMP (WAMPServer) server. I have a test-site with 430 posts and 260 categories.

    But, Sandbox was not too happy. It issued 2 errors, in the early steps described above by Sarah. They were:

    Warning: array_slice() expects parameter 1 to be array, null given in C:\wamp\www\wp3\wp-content\plugins\sandbox\admin-table.php on line 122

    This message appeared at the top of the opening screen, after “Sandbox” was initially select in the Admin menu bar.

    Fatal error: Call to undefined function sandbox_edit() in C:\wamp\www\wp3\wp-content\plugins\sandbox\admin-menu.php on line 29

    This message was appended to the “Of course I’ve backed up my site!” reminder, in the second screen, which is produced after pressing the Add New [Sandboxes] button, in the first screen.

    These issues could very well be simply minor matters associated with the localhost environment. I have not looked at the scripts, but may be able to this evening.

    Interesting tool. In a localhost [I am hopeful that], time-out & loading issues may be either absent, or ‘freely’ resolvable.

    Report


  3. How does this compare to creating another database and cloning the site into a sub-directory on the same server? I maintain a pretty large development account and regularly have multiple test WordPress installations in separate directories. Works, but rarely an identical environment to where the final site is to be installed. This sounds interesting – will have to try in my copious free time (whenever I get some!)

    Report


  4. I love the simplicity of Sandbox. Thanks for writing about it, Sarah!

    I wanted to quickly create, modify, and checkpoint clones of an existing WordPress site, and developed an approach based on the Duplicator WordPress plugin for backups: http://gear11.com/2014/01/wordpress-docker/ Duplicator provides the same kind of “2-clicks” approach as Sandbox, but the cloning process also requires a Linux server (or local virtual machine if you run Windows or Mac) on which to execute the copy. The payoff is that once you are past the setup, you can quickly spool up a clone of any site just based on the Duplicator backup package.

    I’ll have to work hard to get it down to “2-clicks”, but Sandbox provides good inspiration.

    Report


    1. Duplicator is awesome! And I’ll be testing Sandbox plugin as its something many people need (including us, developers) and I like to make my life easier. Duplicator became my best friend last year, hopefully Sandbox (or a similar but superior plugin) will do the same this year :) A much needed feature.

      Report


  5. I would worry that as it is using the same database, that if the copied tables of the sandbox were to get corrupted while testing, that the entire database might corrupted as well. Yeah, having a backup is good, but if it’s a particularly large database, say in the GB range, restoration can be quite time consuming if restoring from an offsite backup. Having gone through something like that with a cloud hosting situation, I’d have to say I’ll pass on it for any production website that has a database of around 200MiB or more in size. I can see the appeal for a small established website or a startup to test different iterations quickly.

    Report


  6. A nice idea. The execution still needs work. The v1.0 issues will get sorted out and for free I can’t complain (too much).

    For this type of work, this is the only plugin I’ve come to trust:
    WP Migrate DB Pro – https://deliciousbrains.com/wp-migrate-db-pro/

    It also handles Media especialy well. :-)

    Report


  7. I use WP Migrate DB Pro for creating / syncing dev and live versions of sites. Very handy plugin.

    Report


    1. Novice help: I used WP Migrate DB free plugin to create an sql file of my local wp databse. BUT, when I try to import that sql file into phpmyAdmin (into my server db) it only imports some tables before crashing. That means, my WHOLE site content ect on my server is unusable. Does the PRO version work better? Can I somehow import the db differently and still keep my 4 months of wp content work? Any suggestions would be appreciated. Thanks

      Report


  8. I suggest a glowing border around the page when in sandbox mode.

    We have had one total failure while using it, when we had the sandbox sign up in admin, but our changes were published. In fact it appears at the moment that the sandbox just does not prevent changes to the home page widgets at all, but since we are in our fine tuning stage for a release today that ticket has been deferred to next cycle. It is a great plugin, and WordPress is better for it, but be careful as you get used to it.

    Kurt

    Report


  9. I’ve been looking for something like this,but I installed it and, alas, it crashed my WP installation hard. Looking forward to seeing updates so that I can try it out again!

    Report


  10. To test plugins conditionally I use “Plugin Test Drive”

    Report


  11. There is a real need for this kind of functionality, so what a shame this plugin was so poorly developed and supported it never got off the ground, and now its out of date and not being maintained. I think you were a little OTT with your praise Sarah, on this occasion.

    Report

Comments are closed.