Is your site no longer working? Has your WordPress site been replaced with a blank white screen, the infamous White Screen of Death?

Is your site telling you “There has been a critical error on the website?”

Maybe you are experiencing styling issues, where your footer is not loading correctly or you are having a tough time checking out in your membership site.

All of these warnings and errors can be resolved through a clear debugging process. While some errors could be related to Paid Memberships Pro, these warnings can occur on any website, using any theme, and with any active plugins. 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 explains how to enable debug mode in WordPress to uncover the exact cause of the issue and help you get your site back to functional.

Video Demo: Debugging Your Membership Site and Using WordPress Site Health Features

Enable Debugging on Your WordPress Site

How to Turn On WP_DEBUG Mode

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

  1. 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.
  2. 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.

Fatal Error Example

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.

How to Turn Off On-Screen Errors and Warnings

By default, WP_DEBUG prints all errors and notifications to your screen.

To stop errors and messages from displaying on your screen, 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.

How to Make a Debug Log File

Along with 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 );

How to Access the debug.log File

Once you have configured your site to log debug information to a file, you can browse 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 website’s control manager.

Important: Once done with your debug.log file, disable WP_DEBUG mode and delete the debug.log file from your site immediately.

Not doing so may result in compromising the security of your site or exposing sensitive information to unwanted parties.

The Total Configuration Code

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 In Summary

  1. Login to your site via FTP or your host’s File Manager.
  2. Navigate to your WordPress install directory and enter it (usually public_html or www).
  3. 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
  4. Search the file for the following line of code: define( ‘WP_DEBUG’, false );
  5. 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.
  6. 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 );
  7. Save your file and re-upload to the same directory – overwrite the file when prompted. (Do not close your FTP client just yet).
  8. Go back to your website using your browser and recreate the issue.
  9. 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.
  10. Download the debug.log file. Feel free to send this log file to our support team.
  11. 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 support team.

Was this article helpful?
YesNo