Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

define('WP_DEBUG', true); does not show errors

Tags:

php

wordpress

I enabled the errors in my wp-config file:

define('WP_DEBUG', true);

But I have an empty white page. No errors are listed.

like image 728
RichardMiracles Avatar asked Aug 28 '15 08:08

RichardMiracles


People also ask

What is WP_debug in WordPress?

WordPress has a Debug Mode. The specific debug system has been designed for simplifying the process of debugging and standardizing the code across the core WordPress files, themes, and plugins. WP_Debug is a PHP constant used by WordPress that triggers the Debug mode on WordPress.

When there is a fatal error in WordPress WSoD?

When there is a fatal error and WordPress 5.2 WSOD works go to recovery mode otherwise your screen will show you the error. @autotutorial OK I appreciate the info–thanks. Let’s call this resolved then

What are deprecated functions in WP_debug?

The deprecated functions are those functions that have been configured to expire at a particular date. If you are using a deprecated feature, the debugging log will provide you an idea into finding a replacement for such a role. The WP_Debug should be an excellent option for troubleshooting any of the issues you may be facing on your site.

Is it OK to add this to WP-config advanced topic?

Is it OK to add this to wp-config: advanced topic, if your server sets the error display (php.ini or user.ini or htaccess flag). When there is a fatal error and WordPress 5.2 WSOD works go to recovery mode otherwise your screen will show you the error.


3 Answers

The below code, inserted in your wp-config.php file, will log all errors, notices, and warnings to a file called debug.log in the wp-content directory. It will also hide the errors so they do not interrupt page generation.

this code you must have to insert BEFORE / That's all, stop editing! Happy blogging. / in the wp-config.php file.

// Enable WP_DEBUG mode
define('WP_DEBUG', true);

// Enable Debug logging to the /wp-content/debug.log file
define('WP_DEBUG_LOG', true);

// Disable display of errors and warnings 
define('WP_DEBUG_DISPLAY', false);
@ini_set('display_errors',0);

// Use dev versions of core JS and CSS files (only needed if you are modifying these core files)
define('SCRIPT_DEBUG', true);

source: https://wordpress.org/support/article/debugging-in-wordpress/

like image 137
Yogendra Avatar answered Oct 10 '22 15:10

Yogendra


Add these two lines below the

define('WP_DEBUG', true);

error_reporting(E_ALL);
ini_set('display_errors', 1);

then delete them when you don't need them any more.

like image 32
Aleksandar Jakovljevic Avatar answered Oct 10 '22 15:10

Aleksandar Jakovljevic


You can write this into your .htaccess file.

php_flag display_startup_errors on
php_flag display_errors on
php_flag html_errors on
php_flag  log_errors on
php_value error_log  /home/path/public_html/domain/PHP_errors.log

Please change the error_log directory.

like image 1
cgee Avatar answered Oct 10 '22 15:10

cgee