How to Enable Debugging in WordPress

by cybersal

Sometimes you need to enable debugging in WordPress to check errors in your plugin  or theme code.

After enabling, WordPress debug will log any errors detected on your site. This can be key to finding the source of an issue on your WordPress website.

Follow the steps to enable debugging in WordPress.

  1. Open wp-config.php from your hosting File Manager.wp-config in wordpress
  2. Open wp-config.php and locate the line
    ('WP_DEBUG',false);

    Enable Debugging in WordPress

  3. Replace your code with the following lines of code
    // Enable WP_DEBUG mode
    define( 'WP_DEBUG', true );
    
    // Enable Debug logging to the /wp-content/debug.log file
    define( 'WP_DEBUG_LOG', true );
    
    // Disable display of errors and warnings
    define( 'WP_DEBUG_DISPLAY', false );
    @ini_set( 'display_errors', 0 );
    
    // Use dev versions of core JS and CSS files (only needed if you are modifying these core files)
    define( 'SCRIPT_DEBUG', true );
  4. Save wp-config.php file.
  5. Reproduce the issue.
  6. You can see that WordPress has creates a debug.log file in wp-content folder. You can see the error details in this file.

 

 

Photo by Negative Space from Pexels

Related Articles

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

Privacy & Cookies Policy