Skip to content

Instantly share code, notes, and snippets.

@kaorukobo
Last active March 19, 2017 08:58
Show Gist options
  • Save kaorukobo/795d43c9a594b021c2d09fffd2935b37 to your computer and use it in GitHub Desktop.
Save kaorukobo/795d43c9a594b021c2d09fffd2935b37 to your computer and use it in GitHub Desktop.
How to Prevent WordPress from stopping rendering without any error mesages, on PHP 7.1+Wordpress (4.7.2)
# Put these on wp-config.php
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
function custom_exception_handler($exception)
{
$logmsg = "Uncaught exception: " . $exception->getMessage() . "\n" . $exception->getTraceAsString() . "\n";
trigger_error($logmsg, E_ERROR);
if (WP_DEBUG) {
echo($logmsg);
}
}
set_exception_handler('custom_exception_handler');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment