Question

I'm getting the error: 'There has been a critical error on your website. Learn more about debugging in WordPress.'.

How do I display which error I'm getting in the frontend?

I have these three lines in my wp-config.php-file:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_DISPLAY', true );
define( 'WP_DEBUG_LOG', true );

It surprises me that enabling WP_DEBUG, doesn't show it. I can (however) still find the errors in /wp-content/debug.log, - but it's just an extra step in development, having to open that file and find the error.

How do I just get the proper error displayed on the page, - and not hid away in that debug.log-file?

I can see that WP_DEBUG is enabled, since this:

echo '<pre>';
print_r( WP_DEBUG);
echo '</pre>';
die();

... returns: 1.

Was it helpful?

Solution

Ahh! I found it.

If I did this:

phpinfo();
die();

Then I could see that 'display errors` was set to off.

So if I added this in the top of my functions.php: ini_set('display_errors', 1);, then it started showing the errors.

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top