Hosting WordPress Spanish version

How to Enable and Disable WordPress Debug Mode

Enable WordPress debug mode in wp-config.php, log errors to debug.log, then disable debugging without showing notices to visitors.

Published: 30/06/2026 Updated: 02/11/2026
In this article

WordPress debug mode helps log errors so you can find the cause of a problem. You configure it in wp-config.php; there is no button to turn it on from the WordPress dashboard. When troubleshooting is finished, disable debugging and remove the log if you no longer need it.

This guide is for self-hosted WordPress sites whose files you can edit. Before changing the configuration, use a staging copy if you have one. If you need to edit the live site, save a secure copy of wp-config.php first: a syntax error can prevent the site from loading. Keep the backup outside the site’s public folder.

Before enabling debug mode

The official WordPress debugging guide recommends using these tools on local or test installations. If you need to log an error on a live site, do so only while troubleshooting and keep messages hidden from visitors.

wp-config.php is usually in the WordPress installation folder, alongside wp-admin and wp-content, though some installations place it one level above. Open it through your hosting panel’s file manager or with FTP/SFTP. Menu names vary by hosting panel. The official guide to editing wp-config.php has more information about this file.

How to enable debug mode

  1. Make a secure copy of wp-config.php. Download it to your computer or save it in a private location outside the public folder.

  2. Find the debugging constants. Open wp-config.php and look for WP_DEBUG, WP_DEBUG_LOG, or WP_DEBUG_DISPLAY. If they already exist, edit those lines instead of adding duplicate definitions.

  3. Enable logging and keep errors hidden. If the constants are not present, add this block before the /* That's all, stop editing! Happy blogging. */ comment:

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

    Debug mode constants in wp-config.php before the end-of-editing comment

    WP_DEBUG enables debugging, WP_DEBUG_LOG saves errors, and WP_DEBUG_DISPLAY prevents them from appearing on the page. The last setting also asks PHP not to display them. In a standard setup, WordPress saves the log to wp-content/debug.log.

  4. Save the file and reproduce the problem once. Then open wp-content/debug.log through the file manager or FTP/SFTP. The log may contain file paths and technical details: do not publish it or send the full file without reviewing it.

If the file does not appear, check that WP_DEBUG and WP_DEBUG_LOG are set to true, that you saved the correct file, and that WordPress processed the action that triggers the error. If the log is still missing, check your hosting error log. Do not change permissions to 777.

How to disable debug mode

When you have finished collecting information, reopen wp-config.php and set the constants like this:

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

If the lines already exist, change their values instead of duplicating them. Save the file and check that the public site and WordPress dashboard load normally. If the site stops loading after you edit it, restore the secure copy of wp-config.php.

Download only the part of the log you need to keep and store it in a private location. Then delete wp-content/debug.log from the server if you no longer need it. WordPress warns that logs may remain in a location accessible from the web.

If you need help

Enabling debug mode does not fix the error; it records information that can help diagnose it. If you are investigating a 500 error, see our guide to fixing a 500 error in WordPress.

If you cannot access the files or the log does not appear, contact the miHosting team with the affected domain, the exact message, and the approximate time. Do not send passwords, your wp-config.php file, or unreviewed full logs.