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.
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
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.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0