Now that Xdebug is installed with your local installation of PHP, it’s time to wire it up to the IDE. This provides us with all of the advantages that Xdebug has to offer.

Installing Xdebug

That is, it allows us to:

  • set breakpoints,
  • step through our code,
  • and watch variables

All the while the program is executing. This means that while is a page is rendering, we’re able to set points in our codebase where we can see what the server is doing with our code.

So, sure, even though it’s called debugging to remove bugs, it can also give insight on how a WordPress-based application, theme, or plugin is executing and can help us gain a better understanding of WordPress core.

Installing Xdebug in Visual Studio Code

At this point, you should have the following environment set up on your local machine:

The remaining tasks for all of the above involve tying Xdebug into Visual Studio Code so we get a literal representation of how WordPress (and thus, our work) is performing, what it’s doing, and so on whenever it’s running in the browser.

With that said, let’s get started.

For Members Only

Thanks for your interest in this article; however, it's available to members only. If you'd like to review this (and have access to all previous and future articles), check out the sign-up page.

Next Time, Screencasts

Debugging is powerful, but can be daunting in many ways. Starting in the next post, I’ll begin sharing some screencasts that walk through how to:

  • debug functions and variables,
  • change values on the fly,
  • work with the debug console,
  • and more.

These will take a bit more time because they will be videos outlining how to do this, but the benefit should be great.

If you’ve not had a chance to catch up with all of the content in this series yet, I highly recommend it.

📣 A Note For Member Perks

Note, however, before the next post around screencasts and the next installment of this series, I have some announcements to make specifically for members of the site that include discounts on WordPress-based software.

I’ll cover more about that next week.

Category:
Articles
Tags: