Tips on how to to debug your WordPress code

Опубликовано: 01 Ноябрь 2024
на канале: viewSource
242
14

On today's episode, Aurooba manufactures a little bug in her code and then Brian helps debug what's going on. As they debug the code, they discuss the high level approach to debugging, some helpful WordPress tools to make finding problems easier, and discuss the role coding standards can have in helping you debug better.

A full transcript of the episode is available on the website. Watch the video podcast on YouTube and subscribe to our channel and newsletter to hear about episodes (and more) first!

Query Monitor – https://en-ca.wordpress.org/plugins/q...
Using either option or options in ACF – https://www.advancedcustomfields.com/...
The code from this episode – https://github.com/viewSourcePodcast/...
Brian's website – https://www.briancoords.com
Aurooba's website – https://aurooba.com
viewSource Newsletter – https://viewsource.fm/subscribe

00:00:00 Introduction
00:02:55 How do you debug?
00:08:16 Live debugging a little problem
00:09:10 Giving context for the bug
00:11:13 Using Query Monitor
00:14:48 Talking through the problem
00:16:51 Adding conditionals appropriately
00:19:09 Debugging a functional logic error
00:19:44 Let's var_dump()!
00:25:50 Thinking about what should happen
00:32:37 Providing code feedback
00:33:54 Being more verbose in your code
00:34:24 Naming variables better
00:35:43 Choosing the right kind of conditionals
00:37:34 Conclusion