Skip to content

Turn on Debugging in WordPress: WP_DEBUG

One could (and perhaps I should) write a whole course on “how to debug in WordPress.” This (unfortunately) isn’t that post, but rather a quick summary of the best first step in debugging WordPress. It is almost the one step you MUST take if you’d going to debug just about anything in WordPress: make sure WordPress is showing the errors by settings WP_DEBUG to true. This isn’t super complicated, but just an invaluable thing to know.

From there, I generally recommend the following steps to solve the problem (this assumes you’re functional at PHP):

  1. Find the error message that relates to the problem you’re trying to debug.
  2. Find the line of code mentioned in the PHP error. If it’s in your code, you’re set. If it’s in WordPress itself, cry! (Or, just be ready for a more complex procedure that I can’t get into here)

But without further ado, here’s a video walking through how to turn on WP_DEBUG in WordPress:

How to Turn on Debugging in WordPress: Using WP_DEBUG to Solve WordPress Issues

  1. Connect to your WordPress site’s file system. You’ll (most likely) do this via (S)FTP, or if it’s a local install it would just mean using your local computer’s file browser.
  2. Open the wp-config.php file in the root of WordPress file system. This is where WordPress stores site setup details — database connection password, etc.
  3. This file will probably already contain something that look like define('WP_DEBUG', false);. If so, you just need to change that “false” to a “true.” If it doesn’t already contain that line, you’ll need to add it. In either case, make sure that the file contains one (and only one) line defining the PHP constant WP_DEBUG as true. So you want: define('WP_DEBUG', true); to be the final result.
  4. Now you’ll get a message that describes the specific cause of that issue to you.

Unfortunately the issues that need debugging will vary wildly. Maybe it’s an incompatible plugin, a broken theme file, or something else. I can’t even guess. So this is where you debugging skills will need to take over. Here’s a great article from Fred about how to do that:

A Guide to Debugging in WordPress with your Reptilian Brain

Yay! 🎉 You made it to the end of the article!
David Hayes

Inline Feedbacks
View all comments

Or start the conversation in our Facebook group for WordPress professionals. Find answers, share tips, and get help from other WordPress experts. Join now (it’s free)!

Would love your thoughts, please comment.x

Most Searched Articles

Best JavaScript Libraries and Frameworks: Try These 14 in 2024

In this post, we look at the best JavaScript libraries and frameworks to try out this year. Why? Well, with JavaScript being available in every web browser, this makes it the most accessible programming language of ...

20 Best Free WordPress Themes for 2024 (Responsive, Mobile-Ready, Beautiful)

If you're looking for only the best free WordPress themes in the market for this year, then you're in the right place. We have more than enough such themes for you right ...

12 Best WordPress Hosting Providers of 2024 Compared and Tested

Looking for the best WordPress hosting that you can actually afford? We did the testing for you. Here are 10+ best hosts on the market ...

Handpicked Articles

How to Make a WordPress Website: Ultimate Guide for All Users – Beginners, Intermediate, Advanced

Many people wonder how to make a WordPress website. They’ve heard about WordPress, its incredible popularity, excellent features and designs, and now they want to join the pack and build a WordPress website of their own. So, where does one get ...

How to Start an Ecommerce Business: Ultimate Guide for 2024

Is this going to be the year you learn how to start an eCommerce business from scratch? You’re certainly in the right place! This guide will give you a roadmap to getting from 0 to a fully functional eCommerce business. ...