Articles in this section
Category / Section

How to Enable WP Debug Mode in WordPress: A Step-by-Step Guide

2 mins read
Updated:

Introduction

Enabling the WP Debug mode in WordPress is essential for troubleshooting and identifying issues on your website. This guide will walk you through the process of turning on the debug mode by editing the wp-config.php file using FTP/SFTP, cPanel, or File Manager.

Prerequisites

  • Access to your WordPress installation files.
  • FTP/SFTP client, cPanel, or File Manager access.
  • A text editor to modify the wp-config.php file.

Step-by-Step Guide

  1. Access Your WordPress Files

    • Use an FTP/SFTP client (e.g., FileZilla) or log in to your hosting control panel (e.g., cPanel).
    • Navigate to the root directory of your WordPress installation. This is typically the folder named public_html or the folder containing your WordPress files.
  2. Locate the wp-config.php File

    • Find the wp-config.php file in the root directory of your WordPress installation.
    • Download a backup of the file before making any changes to ensure you can restore it if needed.
  3. Edit the wp-config.php File

    • Open the wp-config.php file in a text editor.
    • Scroll down to find the line that says: /* That's all, stop editing! Happy publishing. */
  4. Add Debugging Constants

    • Just before the line mentioned above, add the following constants:
      // Turn ON the debug mode
      define( 'WP_DEBUG', true );
      
      // Turn ON the debug logs
      define( 'WP_DEBUG_LOG', true );
      
      // Turn OFF the log display on frontend
      define( 'WP_DEBUG_DISPLAY', false );
      
    • Ensure no conflicting constants are already defined in the file. If you find any, remove or comment them out.
  5. Save and Upload the File

    • Save the changes to the wp-config.php file.
    • If you used an FTP/SFTP client, upload the modified file back to the server, replacing the existing one.
  6. Verify Debug Mode is Enabled

    • Visit your WordPress site and check the debug log file, which is typically located in the wp-content directory with the name debug.log.
    • Ensure that errors are being logged but not displayed on the frontend.

Tips

  • Always create a backup of your wp-config.php file before making any changes.
  • Use a staging environment to test changes before applying them to your live site.
  • Remember to turn off debugging in a production environment to avoid exposing sensitive information.

Additional Context

  • The WP_DEBUG constant enables debugging mode in WordPress.
  • The WP_DEBUG_LOG constant saves errors to a log file for easier review.
  • The WP_DEBUG_DISPLAY constant prevents error messages from being displayed on the frontend, ensuring a better user experience.

By following these steps, you can enable WP Debug mode in WordPress effectively and safely troubleshoot your website issues.

Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
Access denied
Access denied