How to Enable Debugging in WordPress

Do you need to enable debugging in WordPress? This doesn’t apply to only WPForms but when trying to debug anything on your site from any plugin or your WordPress theme.

When adding custom code such as PHP or JavaScript, there are times when you may need to find any possible errors in your code, your theme or other plugins or even on the server in general.

When enabled, WordPress debug will log any errors detected on your site. This can be key to finding the source of an issue or just learning more details about any possible errors on your site.

Enabling debug in WordPress

To enable debugging on your site, please follow the steps below.

1) Locating the wp-config.php file

By default, WordPress debug will be disabled. To enable it, you’ll need to access your site files through either an FTP (File Transfer Protocol) or your server’s cPanel.

To learn more about FTP, please check out this article from WPBeginner. Alternatively, our friends at WPBeginner also have an article on cPanel information, which you can view here.

Alternatively, you can also just install a plugin like WP File Manager to easily gain access to your server files through the WordPress admin area. To learn more about that plugin please check out their plugin on

2) Editing the wp-config.php file

Once your site files are open, you’ll need to open wp-config.php for editing.

This file will be located in the root folder on your server. To learn more about the location and directory instruction, please review this article.

Open wp-config file to enable debugging in WordPress

For more examples on how to edit the wp-config.php file, our friends at WPBeginner have an excellent article that you can review on this.

This file contains site-specific configuration settings, such as database information and, potentially, settings added by your hosting provider. For debugging, you’ll need to find this line of code (which will generally be near the bottom of the file):

('WP_DEBUG', false);

3) Enabling debug

Copy and paste this code snippet over the line of code mentioned in Step 2.

// 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 );

This code will need be to inserted before the comment [php]/* That’s all, stop editing! Happy blogging. */[/php] in the wp-config,php file.

enable debugging inside the wp-config.php file

This will enable debugging and, importantly, prevent any logged data from displaying on your site. Instead, a debug log will be saved to your site files.

4) Replicating the issue

After saving these changes to wp-config.php, you’ll need to return to your site and replicate the issue you saw earlier. This will ensure that it gets recorded in the new error log.

5) Viewing the debug log

Then, you can return to your site files and open

Please know that the URL to the debug.log will depend on exactly how your site is set up. For example, if your site is installed in a subdirectory, the main URL may look like something like this: Check with your hosting company if you’re unsure how to access this file.

The contents of an error log can vary a lot depending on the cause and number of issues, but now you should be able to see extra details, such as a file path to the source of a code error, to help you better track down the issue.

To learn more about debug from WordPress, you can check out their documentation.