Skip to content

Instantly share code, notes, and snippets.

@ekandreas
Last active September 7, 2015 13:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ekandreas/6aa60af3657d41fe55db to your computer and use it in GitHub Desktop.
Save ekandreas/6aa60af3657d41fe55db to your computer and use it in GitHub Desktop.
Whoops

Whoops

Whoops MU-plugin for WordPress error handling in development.

To install, do as follow:

  1. Create folder "whoops" in mu-plugins folder.
  2. Put the two files whoops.php and composer.json inside the folder.
  3. Run composer update in the newly created whoops folder.
  4. Test drive with an error in a WordPress plugin or theme inside your project!

whoops

{
"name": "ekandreas/woops",
"type": "project",
"require": {
"php": ">=5.4",
"filp/whoops": "^1.1"
}
}
<?php
/*
Plugin Name: Whoops
Description: Adds error control as a mu-plugin for WordPress development
Version: 1.0.0
Author: EkAndreas
Author URI: http://www.andreasek.se/
License: MIT License
*/
defined( 'ABSPATH' ) || exit;
// Load Composer autoloader.
if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
require __DIR__ . '/vendor/autoload.php';
}
if( WP_DEBUG ) {
add_action( 'muplugins_loaded', 'load_whoops' );
}
function load_whoops() {
$whoops = new \Whoops\Run;
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
$whoops->register();
}
//EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment