WebGeniusLab logo
  • All Themes
  • Premium Themes
  • Hire Us
  • Support
  • Contacts
Browse Themes
WebGeniusLab logo
WebGeniusLab logo white
  • All Themes
  • Premium Themes
  • Hire Us
  • Support
  • Contacts
Home/Blog/WordPress/How to Enable and Disable WP_DEBUG in WordPress

How to Enable and Disable WP_DEBUG in WordPress

June 30, 2026by Sam Rodman
wordpress debug mode
WordPress

When something breaks on your WordPress site — a white screen, a plugin conflict, or a theme error — the fastest way to find the cause is to turn on WP_DEBUG. This built-in WordPress debugging mode reveals the exact error message and the file it came from, so you can fix the problem instead of guessing. In this guide you will learn how to enable WP_DEBUG in WordPress, how to log errors to a file instead of displaying them on screen, and how to safely disable debugging before your site goes live.

What Is WP_DEBUG?

WP_DEBUG is a PHP constant defined in your site’s wp-config.php file. When it is set to true, WordPress stops hiding PHP notices, warnings, and errors and shows them directly — either on the page or in a log file. It is disabled by default on every WordPress installation to keep visitors from seeing raw error output.

Three constants work together for debugging:

  • WP_DEBUG — master switch that activates debug mode
  • WP_DEBUG_LOG — saves errors to wp-content/debug.log instead of showing them on screen
  • WP_DEBUG_DISPLAY — controls whether errors appear visually on the page (set to false when using the log)

Where to Find wp-config.php

The wp-config.php file sits in the root folder of your WordPress installation — the same directory that contains wp-admin/ and wp-content/. You can edit it via:

  • FTP / SFTP — connect with FileZilla or your preferred client and open the file in a text editor
  • cPanel File Manager — navigate to public_html/ (or your subdirectory), right-click wp-config.php, and choose Edit
  • SSH — nano wp-config.php from your site root

Always make a backup of wp-config.php before editing it. A syntax error in this file will take down the entire site.

How to Enable WP_DEBUG in WordPress

Open wp-config.php and find this line near the bottom of the file:

define( 'WP_DEBUG', false );

Change false to true:

define( 'WP_DEBUG', true );

Save the file. WordPress will now display PHP errors, warnings, and notices directly on every page of your site. This is useful for a quick look, but not ideal if other people can see the site — move to the log-based approach below.

Log Errors to a File Instead of Showing Them on Screen

The recommended approach for debugging on a live or staging site is to write errors to a file. Add all three constants to wp-config.php:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );

With this configuration:

  • Errors are written to wp-content/debug.log
  • Nothing is shown to visitors on the front end
  • The @ini_set line suppresses errors at the PHP level as a safety net

To read the log, open wp-content/debug.log in any text editor or tail it over SSH:

tail -f wp-content/debug.log

Custom Log File Location (WordPress 5.1+)

Since WordPress 5.1 you can specify a custom path for the log file by passing a path string instead of true:

define( 'WP_DEBUG_LOG', '/home/youruser/private/debug.log' );

This keeps the log outside the webroot and prevents it from being publicly accessible — a good practice on production environments.

How to Disable WP_DEBUG

When you have found and fixed the issue, always turn off debug mode before restoring normal traffic to the site. Set all constants back to false:

define( 'WP_DEBUG', false );
define( 'WP_DEBUG_LOG', false );
define( 'WP_DEBUG_DISPLAY', false );

Or simply revert wp-config.php to its original state with only:

define( 'WP_DEBUG', false );

Leaving WP_DEBUG enabled on a production site is a security risk — error messages can expose file paths, database table names, and plugin/theme code to anyone who visits the site.

WP_DEBUG and WordPress Themes

If you are using a WebGeniusLab theme and something is not working as expected, enabling WP_DEBUG is the first diagnostic step we recommend. A PHP notice or deprecated function warning in the log will immediately point to the file and line number causing the problem.

Common things WP_DEBUG reveals in theme environments:

  • A required plugin is deactivated (undefined function errors)
  • A PHP version incompatibility (deprecated function warnings)
  • A missing file referenced by a child theme
  • A memory exhaustion error that caused a blank page

Once you have the error from the log, you can include it in a support ticket and our team will diagnose it much faster.

Quick Reference

Constant Value Effect
WP_DEBUG true Enables debug mode
WP_DEBUG false Disables debug mode (default)
WP_DEBUG_LOG true Writes errors to wp-content/debug.log
WP_DEBUG_DISPLAY false Hides errors from the page output

Summary

Enabling WP_DEBUG in WordPress takes one line in wp-config.php. For production sites, combine it with WP_DEBUG_LOG and WP_DEBUG_DISPLAY = false so errors are captured silently in a log file. Always disable debug mode once you are done — leaving it on exposes internal details about your site to the public. With the error in hand, fixing the problem (or reporting it to a theme or plugin author) becomes straightforward.

prev
How to Speed Up an Elementor Website: 6 Proven Optimizations

How to Speed Up an Elementor Website: 6 Proven Optimizations

Related Posts

wgl_wordpress_activation
BasicsWordPress
June 26, 2026

How to Activate Your WebGeniusLab Theme: Purchase Code vs. License Key

Read More
php_max_vars
BasicsWordPress
June 26, 2026

How to Increase PHP Memory Limit, max_input_vars, and Upload Size in WordPress

Read More
Categories
  • Basics
  • Elementor
  • WordPress
Recent Posts
  • How to Enable and Disable WP_DEBUG in WordPress
  • How to Speed Up an Elementor Website: 6 Proven Optimizations
  • How to Increase PHP Memory Limit, max_input_vars, and Upload Size in WordPress
WebGeniusLab logo white

We create premium WordPress themes for modern businesses — clean design, powerful functionality, and exceptional user experience.

 

FacebookInstagramTelegram-plane

Themes

All Themes

Popular Themes

Best Sellers

Contacts

Support hours

8:00 – 17:00 CET, Mon–Fri

!

All support is handled through our community forum only — no direct email support.

General inquiries

webgeniuslab@gmail.com

Helpful Links

Support Centre

Customization

Terms & Conditions

Reporting Vulnerabilities

Blog

Subscribe

Want the best deals, new theme releases and exclusive discounts? Subscribe and be the first to know.

    © 2026 WebGeniusLab. All Rights Reserved.

    Privacy Policy

    Refund Policy

    Manage Consent

    We use cookies to enhance your experience by collecting data like browsing behavior. You can opt out of data sharing via our link. Opting out may affect some site features.

    Functional Always active
    The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
    Preferences
    The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
    Statistics
    The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
    Marketing
    The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
    • Manage options
    • Manage services
    • Manage {vendor_count} vendors
    • Read more about these purposes
    View preferences
    • {title}
    • {title}
    • {title}