Skip to content

Intercepting errors in WordPress

Warning: this article was written over 12 years ago, some information may be out of date.

If you are using shared hosting, in principle, you will not have access to the server logs.
In some cases, however, it is handy to read the error logs to find out why something does not work.
This trick allows you to monitor errors without showing them on the pages: add the following lines to the wp-config.php file

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

A file called debug.log will be created in the /wp-content/ folder, which will contain all WordPress errors and all PHP errors. If the file is not created, it is likely a write permission problem.

Previous article

Next article

Thread

Leave a comment

Your email address will not be published.