Home > Net >  Locating involved functions in WordPress
Locating involved functions in WordPress

Time:04-21

I'm looking at a site someone else developed. We're using a child theme that is calling back to a lot of its parent's functions. There are about two dozen plugins. Somewhere in there is a bug that's preventing a theme setting from propagating to the rendered page. The problem is, I am not sure what's involved.

I've tried enabling wp_debug, but the page is fairly silent. I've inserted HTML comments into functions and templates that I thought would be involved, but I haven't found one that is actually involved.

Is there a plugin or some way to force WordPress to log every file/function that's loaded for a page? How would you approach this scenario?

CodePudding user response:

This is probably not the best answer, but I've dealt with a lot of similar situations on some of my customers who own WordPress websites.

I usually download the database and website locally and setup a local website using LocalWP, but you can use any web server like XAMPP or WAMP, actually. In the end, this is helpful, because I can quickly find apply functions of my hooks by doing a full-text search on the project.

To track down the error, I echo some logging with a helper function which will also print hook information.

If the code of your child theme is reached, this is a good start. If your website renders with the parent theme, you can focus on the hooks and calls in your child theme and hopefully you will find the error.

You really have to bite the bullet and follow the chain. If your parent theme renders anything you should be able to comment your child theme step by step to pinpoint the cause of the problem.

  • Related