Better error messages upon critical errors – HTTP Error 500


I had an error in a custom class I’ve made, where this was the error:

private function someFunction(): void { // Returns void
    return true; // <- Returns a value, when the function is set to void

In my wp-config.php I have these lines added:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', true );
@ini_set( 'display_errors', 1 );

If I add this: define( 'WP_DISABLE_FATAL_ERROR_HANDLER', true ); to my wp-config.php-file, then I get a HTTP ERROR 500.

But I still got an the message:

There has been a critical error on this website.

How do I get better error messages for situations like these?

I mean… How difficult can it be to tell me where an error like this is in the code. #firstworldproblems

Zeth 4 weeks 0 Answers 4 views 0

Leave an answer