Skip to content
Advertisement

Best way to find out which php file has generated an html line of code in WordPress

Using Chrome you can right click – Inspect element to see the html code behind that element:

Chrome inspect element example

I wonder how to find which php file has generated that html. Maybe there is some tool to put a breakpoint into the html so the php server will stop when trying to generate it again?

I’m using WordPress locally. I’m on Ubuntu 14.04LMS. I’m using Sublime Text 3 with XDebug.


UPDATE 1

A WordPress plugin able to put, in every file, something like the following would be a good solution (I think from my beginner’s viewpoint):

echo '<!-- name_of_the_php_file.php -->';

Advertisement

Answer

Use this plugin “what the file” to find out the php file. Then rest it is to find out a function or something else by CTRL + F in any editor.

I want to add one more plugin which is not exactly for this purpose but it is very popular among WordPress developers and it solves this problem very well. The plugin is Query Monitor.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement