Enable debug for logging errors

by | 3 February 2023 | Code, WordPress | 0 comments

WordPress has the option to write any errors to the debug.log file. Be careful with this and don’t enable all debug features as you may accidentally show the errors on the website and you don’t want that. To enable the debug option, the best option is to insert the code below into the wp-config.php file in the root of the WordPress installation:

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

The bottom line in particular is important as it prevents you from showing any errors on the website that may show vulnerable information. When you have added the code, a debug.log file will be created in the WP-Content folder whenever errors are detected in the many scripts that are executed.