How to Activate Debug Mode in WordPress

    Updated on September 18, 2024

    Reading Time: 2 min

    Facebook
    Twitter
    LinkedIn

    Debug mode in WordPress is a helpful tool for developers to identify and troubleshoot errors or issues within their WordPress site. When enabled, debug mode displays error messages, warnings, and notices that may not be visible otherwise. Follow the steps below to activate debug mode in WordPress:

    Step 1: Access the wp-config.php File

    The first step is to access the wp-config.php file, which is located in the root directory of your WordPress installation.

    Step 2: Edit the wp-config.php File

    Open the wp-config.php file using a text editor of your choice. Look for the following line of code:

    				
    					define( 'WP_DEBUG', false );
    
    				
    			

    Step 3: Enable Debug Mode

    Change the value of WP_DEBUG from false to true to enable debug mode. Your code should now look like this:

    				
    					define( 'WP_DEBUG', true );
    				
    			

    Step 4: Optional: Display Errors

    Optionally, you can also enable the display of PHP errors by adding the following lines of code below the WP_DEBUG definition:

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

    Step 5: Save Changes

    Save the changes you made to the wp-config.php file and close the text editor.

    Step 6: Verify Debug Mode

    To verify that debug mode is enabled, navigate to your WordPress site. If there are any errors, warnings, or notices, they will be logged in the wp-content/debug.log file. You can access this file via FTP or your hosting provider’s file manager.

    This will ensure that debug information is logged to the debug.log file located in the wp-content directory of your WordPress installation.

    Step 7: Disable Debug Mode (Optional)

    Once you have finished troubleshooting, it’s a good practice to disable debug mode to prevent error messages from being displayed to your site visitors. Simply set WP_DEBUG back to false in the wp-config.php file.

    				
    					define( 'WP_DEBUG', false );
    				
    			

    Step 8: Conclusion

    Congratulations! You have successfully activated debug mode in WordPress. Remember to use this feature responsibly and disable it when not needed to ensure a smooth user experience on your website.