Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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