In this article:
WP_DEBUG is a useful technique for troubleshooting and debugging issues in your Crio Pro WordPress theme or any WordPress theme or plugin. It allows you to view detailed error messages and warnings that can help you identify and resolve problems with your WordPress website.
Here’s a step-by-step guide to enabling WP_DEBUG:
Accessing your WordPress Files
To begin, you’ll need access to your WordPress website files. There are two common methods for accessing your files:
- File Manager: If your web hosting provider offers a file manager, you can access it through your hosting control panel (e.g., cPanel) and locate the WordPress root directory.
- FTP (File Transfer Protocol): Use an FTP client such as FileZilla to connect to your website’s server and navigate to the WordPress root directory.
Locate the wp-config.php File
Once you have access to your WordPress files, locate the wp-config.php file in the root directory. This file contains essential configuration settings for your WordPress site.
Backup your wp-config.php File
Before making any changes, it’s always a good idea to create a backup of your wp-config.php file. Right-click on the file, select “Download” (or “Download as”), and save it to your local computer.
Edit the wp-config.php File
Open the wp-config.php file using a text editor. You can use a code editor like Notepad++ or a built-in text editor provided by your FTP client or file manager.
Define the WP_DEBUG Constant
Within the wp-config.php file, look for the section that contains other WordPress constants. It typically starts with the line /* That’s all, stop editing! Happy blogging. */. Just above this line, add the following line of code:
define( 'WP_DEBUG', true );
This line enables the
WP_DEBUG mode in WordPress.
Save and Upload the wp-config.php File
After adding the
define( 'WP_DEBUG', true ); line, save the wp-config.php file. If you’re using an FTP client, it may prompt you to upload the modified file back to the server. Confirm the upload, overwriting the existing wp-config.php file.
Check for Errors
WP_DEBUG enabled, your WordPress website will display detailed error messages and warnings. If there are any issues or errors on your site, they will now be visible.
Debugging with WP_DEBUG_LOG
WP_DEBUG mode displays errors on your website’s pages. However, it’s often helpful to log the errors in a file for easier analysis. To enable error logging, add the following lines of code after the
define( 'WP_DEBUG', true ); line:
define( 'WP_DEBUG_LOG', true ); define( 'WP_DEBUG_DISPLAY', false );
With these lines added, errors will be logged to a file called debug.log, located in the wp-content directory of your WordPress installation.
Analyzing the Debug Log
To access the debug.log file, go back to your WordPress files and navigate to the wp-content directory. Locate the debug.log file, and you can open it with a text editor to view the logged errors and warnings.
Disabling WP_DEBUG Mode
Once you have resolved the issues and completed the debugging process, it’s recommended to disable
WP_DEBUG to prevent error messages from being displayed on your live website. Simply edit the wp-config.php file again, locate the line
define( 'WP_DEBUG', true );, and change
define( 'WP_DEBUG', false );
Save the wp-config.php file and upload it back to your server.
That’s it! You have successfully enabled and configured
WP_DEBUG in your WordPress website. Remember to use this debugging mode only for troubleshooting purposes and disable it on production websites to avoid displaying error messages to your visitors.
200+ Design Templates + 1 Kick-ass SuperTheme
6 WordPress Plugins + 2 Essential Services
Everything you need to build and manage WordPress websites in one Central place.