Learn how to debug WordPress efficiently without displaying error messages on your website that visitors can read directly.
When your WordPress website encounters an error, you naturally need to debug it to find the cause. However, if you simply enable the standard debug mode, error messages and even your WordPress installation path can be visible to your website visitors.
To prevent website visitors from seeing detailed website errors while you are debugging, you can follow the steps on this page.
How to Debug WordPress Without Displaying Error Messages on Your Website
Before performing this debugging method, ensure you have access to the file manager for your website, such as the File Manager in cPanel.
If you can do this, you are ready to debug using this method.
1. Open the WordPress Installation Folder
The first step you need to take is to open the WordPress installation folder in your file manager. For example, if you are using cPanel, you can open the folder public_html.
2. Edit the wp-config.php File
Now you can look for the file wp-config.php in your WordPress installation folder, then edit that file.
When editing the file, look for the line WP_DEBUG whether it has a value of true or false, then change it to look like this and save it.
define( 'WP_DEBUG', true );define( 'WP_DEBUG_LOG', true );define( 'WP_DEBUG_DISPLAY', false );@ini_set( 'display_errors', 0 );3. Check the Debug Log
Once the file is saved, you can check the cause of the error on your website by opening the file /wp-content/debug.log and if there is an error, you will get information about the cause without displaying the details to your website visitors.
4. Disable the Debug Log
If you have successfully made the repairs, you can disable the debug log by reconfiguring the debugging settings in wp-config.php to look like this
define( 'WP_DEBUG', false );define( 'WP_DEBUG_LOG', true );define( 'WP_DEBUG_DISPLAY', false );@ini_set( 'display_errors', 0 );That is how to debug WordPress without displaying detailed error messages on your website, which you can try when your WordPress site is experiencing issues while in production.
COMMENTS
Loading...