fbpx
Skip to content

How to Enable Debugging in WordPress

    how to enable debugging in wordpress

    Last Updated on: 10th November 2023, 06:08 pm

    Debugging is an essential skill when managing a WordPress website, especially when faced with a white screen of death or other unclear issues.

    WordPress includes a built-in debugging environment, that gives developers a robust toolset for troubleshooting. Despite its usefulness, it’s not always clear how to enable this mode. This guide will walk you through the process.

    1: Access Your WordPress Files

    To start, you will need to access your website’s files. You can accomplish this through your hosting provider’s control panel (using a tool like File Manager) or by connecting to your server via an FTP client, such as FileZilla.

    2: Locate the wp-config.php File

    The wp-config.php file is a critical file in your WordPress installation. It contains information about your database and controls many aspects of WordPress.

    This file is typically located in your WordPress root directory, often named ‘public_html‘.

    3: Edit the wp-config.php File

    In your root directory, locate the wp-config.php file, right-click on it, and select ‘Edit‘ or ‘Code Edit‘. If your FTP client prompts you with a warning message, proceed by clicking ‘Edit’.

    4: Enable Debug Mode in WordPress

    Within the wp-config file, find the line of code that reads, define('WP_DEBUG', false);.

    This line tells WordPress that debug mode is turned off. To turn it on, you need to change ‘false’ to ‘true’. So, the line of code should read define('WP_DEBUG', true);.

    Although you’ve turned on WordPress debugging, these errors will be visible on the front end of the website (which you might not want). To prevent this from happening, add another line of code: define('WP_DEBUG_DISPLAY', false);

    To ensure all error messages get stored in a separate log file (instead of being displayed on your live site), you can add one more line: define('WP_DEBUG_LOG', true);.

    This will create a debug.log file within the wp-content directory where all error messages will be logged.

    5: Save Your Changes

    Afterward, save your changes and close the file. With debugging enabled, WordPress will log any errors it encounters in the debug.log file.

    Final Thoughts

    It’s necessary to note that while debugging mode is tremendously useful, leaving it enabled all the time, especially on a live site, is not recommended, because it uses more server resources. Remember to turn it off once you finish up your debugging work.

    Always make sure to back up your site before making changes like these. If you don’t feel comfortable diving into your site’s backend or you’re dealing with persistent issues, you might consider reaching out to a WordPress professional. Happy troubleshooting!

    Share this post on social!

    Comment on Post

    Your email address will not be published. Required fields are marked *