Skip to content

Instantly share code, notes, and snippets.

@westonruter
Last active March 22, 2019 18:48
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save westonruter/583a42392a0b8684dc268b40d44eb7f1 to your computer and use it in GitHub Desktop.
Save westonruter/583a42392a0b8684dc268b40d44eb7f1 to your computer and use it in GitHub Desktop.
Disable WSOD detection on WordPress 5.1 so that fatal errors during development don't constantly cause plugins to suspend
<?php // phpcs:disable WordPress.Files.FileName.InvalidClassFileName
/*
* Plugin Name: Non-Handling Shutdown Handler
* Description: Disable WSOD protection so that plugins will not auto-suspend during development while errors often occur.
* Plugin URI: https://gist.github.com/westonruter/583a42392a0b8684dc268b40d44eb7f1
* Plugin Author: Weston Ruter
*/
/**
* Class Non_Handling_Shutdown_Handler
*/
class Non_Handling_Shutdown_Handler extends WP_Shutdown_Handler {
/**
* Override the shutdown handler to no-op.
*/
public function handle() {
// No-op.
}
}
return new Non_Handling_Shutdown_Handler();
@szepeviktor
Copy link

szepeviktor commented Feb 22, 2019

Maybe the last return serves no purpose.

The file must return the instance of the class that should be registered.

https://core.trac.wordpress.org/browser/trunk/src/wp-includes/class-wp-shutdown-handler.php?rev=44524

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment