When your website is live and available to viewers, you will not want to advertise any error messages that can be displayed when WordPress debugging is enabled. This can lead to security issues or disruption to your website. However, there are times when it may be necessary to enable WordPress debugging so that you can identify specific issues within your WordPress site. You can then use these errors to diagnose and resolve the problems. Show
WordPress debugging is both a process to identify possible website issues and also a mode that can be enabled for your WordPress site for this same purpose. WordPress debugging can be enabled in the WordPress configuration file and also used with the new Site Health tool. In this guide, you will first learn how to verify if WordPress debugging is enabled. We will then show you how to edit the WordPress configuration file to enable the built-in debugging option. We will also show you the commands for enabling and disabling debugging using WP-CLI. Finally, we’ll cover how to enable debugging and error logging in cPanel using the File Manager. We recommend backing up your WordPress site before making any changes.
Need a new home for your WordPress site? Check out InMotion’s WordPress Hosting solutions for secure and performance-oriented servers. Don’t have time to read our full article? Watch our walk-through video. Checking Site Health Tool for Debug StatusWordPress comes with the option for debugging, but it is not enabled by default. You can easily check to see if debugging has been enabled using the Site Health option in WordPress Tools. Follow the steps below to check if debugging has been enabled on your WordPress site:
When debugging is set to display errors, this means that error messages will appear on the front end of your WordPress site when it is being viewed. Anyone seeing the error messages will automatically make assumptions about your website or believe something is wrong. So it is often recommended that the debug mode be disabled when the site is actively being used by your visitors. Here you can see the details provided when you click on the drop-down arrow: Note that you can see the details on how the debug mode has been enabled. They also provide the link for the direct documentation from WordPress on using their debug mode. When debug mode is enabled, error messages will appear in the front end of your WordPress site. For example, How to Enable WordPress Debugging in the wpconfig.php FileThe Site Health tool gives you an overview of when the debugging mode in WordPress is enabled. You will still need to edit the wpconfig.php file in order to enable debugging. You will need to directly access your WordPress installation files in order to make the necessary file change. The wp-config.php file is a text file, so any text editor will let you edit the file once you can access it. For this example, we are going to use the cPanel File Manager to access the wp-config.php file.
Debug OptionsThere are multiple options for WordPress debugging available to you by using another line of code under the “define( ‘WP_DEBUG’, true )” line. You can add a single option, several, or all of them. Here is the code for each and description of what each option provides: WP_DEBUG_LOG
This option saves errors on your WordPress site to a debug.log file. If there are multiple errors, or if they are generating errors that can’t be read on-screen, then this option will need to be activated. You can determine the location and name of the file like this:
WP_DEBUG_DISPLAY
This option provides the opportunity to have debugging enabled, but without the error messages appearing on the front end of the site. This option should be used with the WP_DEBUG_LOG option in order to capture the errors that may be occurring on your site. Be careful with this option as it can hide errors being displayed that would otherwise give you the information to help troubleshoot your site. This option is set to “true” by default. SCRIPT_DEBUG
Script_Debugt forces your WordPress site to use the “dev” versions of the core CSS and Javascript instead of the minified versions that are normally loaded with an operating WordPress site. Normally, this option defaults to “false”, but it can help you test Javascript or CSS files that you have modified for your site. SAVEQUERIES
If you are having issues that relate to your WordPress database, then you may want to use this version in order to view your database queries. Queries are saved in an array on your database in a table called “queries”. Caution should be taken when using this option as it can slow the performance of your site. This option should not be active when you are normally operating your website. Once you have the debug mode on, you can review the errors that are being produced to help you troubleshoot your WordPress site. Remember to disable the debug mode once you have completed troubleshooting your site. Check Debugging Status With WP-CLIYou must install WP-CLI on your server before you can follow these sections. Using the wp-config list command, you can determine if the WP_DEBUG constant is set to true (enabled) or false (disabled).
Enable Debugging With WP-CLIYou can also enable debugging by creating/modifying a new wp-config.php file using WP-CLI. The WP-CLI command wp config allows you to generate a wp-config.php file. The generated config file includes the list variables, constants, and other required settings for running a WordPress site. In this section, you will learn how to set WP_DEBUG to true to enable debugging mode for WordPress.
Now you know how to use WP-CLI to check, enable and disable debugging for WordPress. Learn more about WP-CLI, the command-line interface for WordPress, and streamline your WordPress maintenance workflow! Enable WordPress Debugging Using File ManagerWordPress debugging is something that is enabled within your wp-config.php file. With just a simple edit to this file, you will be able to view any errors produced within WordPress. For more information on the WP Debug global variable, see the WordPress Codex page.
Now that you have enabled debugging within WordPress, you should be able to see any errors that are produced within your WordPress site. Visit our WordPress Education Channel for lots of helpful guides. Learn more tips and tricks about WordPress backups to protect your website from risks! Check out more WordPress tutorials from the support center:
How do I enable debug mode?Enabling USB-Debugging. On the Android device, open the settings.. Tap Developer Settings. The developer settings are hidden by default. ... . In the Developer settings window, check USB-Debugging.. Set the USB mode of the device to Media device (MTP), which is the default setting.. How can you turn on/off debug mode in WordPress?Locate the wp-config. php for your WordPress file, then click on the three-dotted options, then Edit. To Enable WP_Debug, change the last line to: define( 'WP_DEBUG', true ). To Disable WP_Debug, change the last line to: define( 'WP_DEBUG', false ).
How do I debug WordPress locally?Debug Live WordPress Site on Local Server. Step 1: Set up Local Machine for WordPress site Hosting using MAMP. ... . Step 2: Create database on your local machine. ... . Step 3: Set up WordPress on your local machine and run it on MAMP server. ... . Step 4: Move WordPress Live Site Files to Local Server.. How do I use WordPress debugging plugin?To enable SCRIPT_DEBUG , you can either: Use the free WP Debugging plugin from above, which enables it by default. Add the following constant to your wp-config. php file – define( 'SCRIPT_DEBUG', true );
|