Sometimes, your WordPress website may not work as expected due to plugin conflicts, theme issues, PHP errors, or recent updates. In some cases, the error may appear clearly on the screen, but other times, the issue may stay hidden and make troubleshooting difficult.

This is where WordPress debug mode becomes helpful. By enabling debug mode, you can track errors, warnings, and notices generated by your website and store them in a debug log file. This makes it easier to identify what is causing the problem without showing technical error messages to your visitors.

In this guide, we will show you how to enable debug mode in WordPress safely using the wp-config.php file. You will also learn where to find the debug.log file, how to understand common debug messages, and how to disable debug mode after troubleshooting.

Important Things to Consider Before Enabling Debug Mode

Before enabling WordPress Debug Mode, take a few precautionary steps to avoid exposing sensitive information, losing data, or complicating the troubleshooting process. These best practices will help you debug your website safely and efficiently.

1. Create a Full Website Backup

Always create a complete backup of your WordPress files and database before making any configuration changes. If something goes wrong while troubleshooting, you can quickly restore your website to its previous state.

2. Use a Staging Environment

Whenever possible, enable debug mode on a staging site instead of your live website. This allows you to investigate issues safely without affecting visitors or exposing technical errors publicly.

3. Understand Error Logging vs Error Display

WordPress can either display errors on-screen or save them to a log file. For live websites, it’s best to log errors while keeping them hidden from visitors to avoid exposing sensitive information.

4. Verify Access to wp-config.php

Debug mode is enabled through the wp-config.php file. Before starting, make sure you can access and edit this file using your hosting file manager, FTP, SFTP, or SSH.

5. Review Recent Website Changes

Take note of any recent plugin updates, theme changes, WordPress core updates, or custom code additions. Recent modifications are often the source of the issue you’re trying to troubleshoot.

6. Clear Website Caches

Clear your WordPress cache, server cache, CDN cache, and browser cache before testing. Cached content can sometimes hide errors or prevent you from seeing recent changes.

7. Check File Permissions

If you plan to use debug logging, WordPress must be able to create and write to the debug.log file. Incorrect file permissions may prevent logs from being generated.

8. Identify the Issue You Want to Reproduce

Before enabling debug mode, determine the exact action or page that triggers the problem. Reproducing the issue after enabling debugging will generate more useful log entries.

9. Be Aware of Log File Growth

Debug logs can grow quickly, especially on busy websites. Monitor the size of the debug.log file and remove or archive it once troubleshooting is complete.

10. Inform Other Team Members

If multiple people manage the website, let them know that debugging is being performed. This helps prevent conflicting changes and makes troubleshooting more organized.

How to Enable WordPress Debug Mode?

Enabling debug mode in WordPress requires editing the wp-config.php file. This file contains important configuration settings for your website, including the debugging options used to identify errors, warnings, notices, and compatibility issues.

Follow the steps below to enable WordPress debug mode safely.

Step 1: Access Your Website Files

First, access your WordPress installation using one of the following methods:

  • cPanel File Manager
  • Plesk File Manager
  • Hosting File Manager
  • FTP client
  • SFTP client
  • SSH access

Once connected, navigate to your website’s root directory where the WordPress files are stored.

Step 2: Locate the wp-config.php File

Inside your WordPress root directory, look for the wp-config.php file.

You will typically find it alongside folders such as:

wp-admin
wp-content
wp-includes
wp-config.php

This file controls many core WordPress settings, including debugging.

Step 3: Open the wp-config.php File

Open the wp-config.php file using your hosting file editor or preferred code editor.

Step 4: Find the WP_DEBUG Setting

Search for the following line:

define( 'WP_DEBUG', false );

By default, WordPress keeps debugging disabled on most websites. If this line already exists, you can replace it with the recommended debug configuration below.

Step 5: Add the WordPress Debug Code

Add the following code before this line:

/* That's all, stop editing! Happy publishing. */

Recommended code:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );
Example of WordPress debug code added inside the wp-config.php file.

This setup enables WordPress debugging, saves errors to a log file, and prevents error messages from being displayed publicly to website visitors.

Step 6: Save the Changes

Save the updated wp-config.php file. If you are using FTP or SFTP, upload the updated file back to your server.

The debugging settings will take effect immediately.

Step 7: Reproduce the Issue

Visit the page or perform the action that is causing the problem on your website.

For example, you may:

  • Open a broken page
  • Test a malfunctioning plugin
  • Submit a contact form
  • Access a page showing an error
  • Check a booking, checkout, or payment page

WordPress will log any related errors during this process.

Step 8: Find the WordPress Debug Log File

Once WordPress detects an error, it will create a debug log file inside the wp-content folder.

You can usually find the file here:

wp-content/debug.log
The debug.log file is usually created inside the wp-content folder.

To access it, open your WordPress installation folder using your hosting file manager, cPanel, FTP, SFTP, or SSH. Then open the wp-content folder and look for the debug.log file.

If the file is not visible immediately, it usually means WordPress has not recorded any error yet. In that case, revisit the page where the issue occurs and check the wp-content folder again.

Step 9: Open and Review the debug.log File

Open the debug.log file to review the error messages generated by WordPress.

Example of PHP errors and notices recorded inside the WordPress debug.log file.

The log file may include PHP notices, warnings, fatal errors, deprecated function messages, or file paths that show where the issue is coming from.

When checking the log file, look at the latest entries first. The most recent errors are usually added at the bottom of the file. These details can help you identify whether the issue is related to WordPress core, a plugin, a theme, PHP compatibility, or a server configuration problem.

If the issue is related to WP Travel, you can copy the latest relevant error lines and share them with the WP Travel support team for faster troubleshooting.

Step 10: Disable Debug Mode After Troubleshooting

After you identify and fix the issue, disable debug mode to keep your website clean and secure.

To disable debug mode, change this line:

define( 'WP_DEBUG', true );

To:

define( 'WP_DEBUG', false );

You can also remove the extra debug constants if they are no longer needed:

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

Leaving debug mode enabled for a long time can create large log files and may expose sensitive technical information if configured incorrectly. After troubleshooting, you should also delete or secure the debug.log file if it contains sensitive details.

Tips for Debugging WordPress

When debugging WordPress, start by checking the latest error logs, reviewing file paths, and matching errors with the exact action that caused the issue. Use tools like Query Monitor, Health Check, browser developer tools, and server logs to find the cause faster, then document the final fix for future reference.

1. Start With the Latest Error Entry

Always check the newest error first. The latest entry usually appears at the bottom of the log file and is often closest to the issue you just tested.

2. Match the Error Time With Your Test Action

Compare the error time with the exact moment you reproduced the issue. This helps you avoid fixing old errors that are no longer related to the current problem.

3. Read the File Path Carefully

The file path can tell you where the issue starts. If the path includes /plugins/, the issue may come from a plugin. If it includes /themes/, the issue may come from your active theme.

4. Separate Notices, Warnings, and Fatal Errors

Not every debug message has the same impact. A notice may point to a minor code issue, while a fatal error can stop a page, plugin, or feature from working completely. Focus on fatal errors and repeated warnings first.

5. Use Query Monitor for Deeper Checks

Use Query Monitor when you need more detail than a normal debug log provides. It can help you inspect database queries, PHP errors, hooks, actions, scripts, styles, HTTP API calls, REST API issues, AJAX requests, and WooCommerce problems.

6. Use Health Check for Safer Conflict Testing

Use the Health Check and Troubleshooting plugin when you need to test plugin or theme conflicts without changing the site for normal visitors. Its Troubleshooting Mode disables plugins and switches to a default theme only for your user session, so other visitors can continue using the live site normally.

7. Check the Browser Console for Front-End Issues

Use the browser console when menus, sliders, forms, popups, checkout buttons, or other interactive features stop working. JavaScript errors, blocked files, or missing scripts often appear there before they appear in WordPress logs.

8. Inspect Failed Network Requests

Open the Network tab in your browser developer tools and look for failed requests. This can help you find blocked AJAX calls, missing images, failed form submissions, REST API errors, slow third-party scripts, or files that are not loading correctly.

9. Use SCRIPT_DEBUG for Script and Style Issues

If you are debugging JavaScript or CSS problems, SCRIPT_DEBUG can help WordPress load development versions of core scripts and styles instead of minified versions. This can make errors easier to trace during testing.

10. Use SAVEQUERIES Only for Short Tests

SAVEQUERIES can help you inspect database queries, query time, and the function that called each query. However, it can affect site performance, so use it only for short debugging sessions and turn it off when you are done.

11. Check Server Error Logs Too

WordPress debug logs may not catch every issue. Also check your hosting server error logs when you face 500 errors, blank pages, memory errors, timeout errors, permission issues, or server-level failures.

12. Test With WP-CLI When the Dashboard Fails

If your WordPress dashboard is slow, broken, or inaccessible, WP-CLI can help you inspect plugins, themes, settings, and database status from the command line. You can also use its debug options to get more detailed output while troubleshooting.

13. Check PHP Version and Memory Limit

Some plugins and themes require a specific PHP version or a higher memory limit. If errors mention memory exhaustion, unsupported syntax, deprecated functions, or compatibility problems, review your PHP version and server limits.

14. Document the Final Fix

Write down the issue, error message, affected page, tested plugin or theme, and final solution. This makes future troubleshooting easier and helps your team fix the same issue faster if it happens again.

Conclusion

Enabling debug mode in WordPress is one of the easiest ways to identify hidden errors, plugin conflicts, theme issues, and PHP warnings on your website. By adding the proper debug code to the wp-config.php file, you can record errors safely in the debug.log file without showing them publicly to visitors.

After reviewing the log and fixing the issue, make sure to disable debug mode and delete or secure the debug log file if needed. If the issue is related to WP Travel, you can share the relevant error details with the WP Travel support team for quicker assistance.

Check the WP Travel documentation to learn more about configurations, modules, payments, and shortcodes.

Your feedback helps us improve. Feel free to share your thoughts!

Need assistance? Contact our support team, join our Facebook community, and subscribe to our YouTube Channel for video tutorials.

You can also find us on Facebook, Instagram, LinkedIn, TikTok, and X. Thank you for choosing WP Travel.

If you are a WP Travel Free user thinking about upgrading to Pro, simply click on the banner below.

Get WP Travel Pro