Is your site no longer working? Has your WordPress site been replaced with a blank white screen, the infamous White Screen of Death? Maybe you are experiencing styling issues, your footer is not loading correctly, or you are having a tough time checking out of your site. This is not unique to Paid Memberships Pro and can occur on any website, using any theme or any plugin(s). Knowing what is causing the problem can give you or a developer the relevant information needed to help fix these issues.
Whatever the reason, this article will explain how to enable debugging mode in WordPress to uncover any PHP errors or warning messages that are on your site.
Turning WP_DEBUG Mode on.
WP_DEBUG is a PHP constant (a permanent global variable) that can be used to trigger the “debug” mode throughout WordPress. It is assumed to be false by default and is usually set to true in the wp-config.php file on development copies of WordPress.” – WP DEBUG, WordPress Codex
- Before getting started you will need to be able to access your WordPress site files by means of an FTP Client or your website’s control panel.
- To turn WP_Debug mode on, navigate to your wp-config.php file (found in your WordPress install directory), edit the file using a text editor of your choice. Once the file is open, search for the following line of code
define( 'WP_DEBUG', false );and change the value from false to true. If you do not find the WP_DEBUG line of code in your wp-config.php file, you can simply add it toward the bottom of the file. It is usually placed below the table prefix, but certainly above the
/* That's all, stop editing! Happy blogging. */line.
With WP_DEBUG turned on, errors will be displayed right on your homepage, so your site may appear broken (or more broken). Copy the entire error message down to share with the support team or developer working on your site.
To hide the errors again, change WP_DEBUG mode back to false. It is often acceptable to turn on WP_DEBUG, navigate to your site and copy the error, and finally navigate back to your wp-config.php file and turn off WP_DEBUG. When dealing with a live site, any visitors who were browsing your site would be interrupted by the error/message notification. It’s important to hide those errors again as quickly as possible or use the instructions below to send the errors to a log file that only you can see.
Turning off errors that would otherwise display on-screen.
By default, WP_DEBUG will display all errors and notification to your screen. This is not ideal in many cases as the notification/errors will replace the actual webpages of your site with the error messages. To stop errors and messages from displaying on your screen, you can add the following line of code to your wp-config.php file, just under the WP_DEBUG line:
define( 'WP_DEBUG_DISPLAY', false )
With this constant set to false, errors are not displayed on screen but are still saved to your web server’s PHP error log. You can set a specific error log for WordPress errors using the steps below.
Making a Debug log file.
WP_DEBUG, you can use
WP_DEBUG_LOG , this will save all errors and notifications to a debug.log file that you can use as a reference of any errors/php notifications. You can also use this file to send to any developer or support engineer who is working on your site. In the event that there were no errors found, a debug.log file will not be created.
Simply add the following line of code to your wp-config.php file under the other WP_DEBUG constants:
define( 'WP_DEBUG_LOG', true )
Accessing the Debug.log File
Once you have added the
define( 'WP_DEBUG_DISPLAY', false ) line of code to your wp-config.php file , you will find the debug.log by navigating to your wp-content folder found in the WordPress install directory. You will need to access this part of your website by using a FTP client or through your websites control manager.
What it looks like all together.
Now that you have added all the lines of code to your wp-config.php file, you should have something similar to the below coding example:
WordPress Debugging – Summarized
- Login to your site via FTP or your host’s File Manager.
- Navigate to your WordPress install directory and enter it (usually public_html or www).
- Find the wp-config.php file and edit with a text editor of your choice. Some popular text editors to use are: Atom, Sublime 3 and PHPStorm
- Search the file for the following line of code: define( ‘WP_DEBUG’, false );
- Change this value from false to true. This will now output errors to your site by displaying them right on your homepage, so instead of your site you will see any underlying errors. To get your website back, change WP_DEBUG mode back to false.
- Directly below this you can enter two new lines of code to send errors to a log file:
- define( ‘WP_DEBUG_DISPLAY’, false );
- define( ‘WP_DEBUG_LOG’, true );
- Save your file and re-upload to the same directory – overwrite the file when prompted. (Do not close your FTP client just yet).
- Go back to your website using your browser and recreate the issue.
- Head back on over to your FTP client and navigate to wp-content and expand the folder, your debug.log file will be loaded into this directory if there are any PHP errors.
- Download the debug.log file. Feel free to send this log file onto your support engineer.
- For a more detailed guide on debugging in WordPress, have look at the WordPress codex.
This looks tough – I need help.
If you are uncomfortable editing your wp-config.php file or are otherwise having trouble following these instructions, reach out to your hosting company for help. You can ask them the following in a support ticket or through email:
Can you tell me how to find the PHP error log for my website at example.com and send me a list of the last 20 errors that have occurred?
Exactly how to access error logs varies depending on your host and server setup. Any good host should be able to respond to request above.
If you would like our help fixing a PMPro-related error on your site, we have a team of Support Engineers that are equipped to help you with your debugging questions. Feel free to get in touch with our team over on our Members Support Forum.