WP Safe Updates

Description

Test WordPress plugin updates safely before applying them on the live site.

This plugin adds a “test update” button when plugin updates are available. Clicking it triggers the creation of a sandbox where the user can safely test updating plugins without affecting the live site. Once the user is finished testing the plugin, they can go back to the live site and do updates if they like.

The sandbox works similarly to how WordPress multisite works. We tell WordPress to temporarily use a different database prefix and a different plugins directory while in the alternative heap (sandbox). This is done by sending WordPress a special _alt_heap cookie.

Disclaimer

Please make sure to always have backups of all your WordPress files and database before updating plugins or themes. We are not responsible for any misuse, deletions, white screens, fatal errors, or any other issue arising from using this plugin.

Contributing

Please contribute to this project on Github. Pull requests welcome!

https://github.com/anttiviljami/wp-safe-updates

Screenshots

  • The 'test update' button when an update is available for a plugin
  • Updating the plugin safely in an alternative heap
  • Testing the updated plugin

Installation

Install and activate the plugin via wp-admin.

Then copy the db.php file from this plugin to your wp-content directory.

Finally, paste these lines to your wp-config.php.

/**
 * WordPress Safe Updates required configuration
 */
function currheap() {
  return isset( $_COOKIE['_alt_heap'] ) && ! empty( $_COOKIE['_alt_heap'] ) ? preg_replace('/[^a-z0-9_]/', '', strtolower( $_COOKIE['_alt_heap'] ) ) : false;
}
defined( 'WP_CONTENT_DIR' ) || define( 'WP_CONTENT_DIR', dirname( __FILE__ ) . '/wp-content' );
defined( 'WP_CONTENT_URL' ) || define( 'WP_CONTENT_URL', '/wp-content' );
if ( false !== currheap() ) {
  defined( 'WP_PLUGIN_DIR' ) || define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins_tmp_' . currheap() );
  defined( 'WP_PLUGIN_URL' ) || define( 'WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins_tmp_' . currheap() );
  defined( 'PLUGINDIR' ) || define( 'PLUGINDIR', 'wp-content/plugins_tmp_' . currheap() );
}

FAQ

None yet.

Reviews

Brilliant plugin – should be in core

Title says it all. This plugin could remove so many headaches when users update plugins on a live site and then run into problems that they struggle to resolve. Could it also be extended to include the updating of themes?

Wish this worked.

I know this is in Alpha but I could not get it to work.

I did add the cookie code to the config file but I still get prompted asking me to add the code.

Read all 5 reviews

Contributors & Developers

“WP Safe Updates” is open source software. The following people have contributed to this plugin.

Contributors

Changelog

Commit log is available at https://github.com/anttiviljami/wp-safe-updates/commits/master