I would like to make the entire widget a link. Ideally, I would like to find the php file that has created the widget and then modify that.

Q: Is there a way to backtrace the HTML to find what php created it?

Q: Is there a typical location that widget php files are located. I have looked in the body, header, for a widget.php.

I am using Responsive theme.

1 Answer 1


If the widget is part of the wordpress core, you can see its source in wp-includes/default-widgets.php.

If it came with a theme or plugin, you can find the code there. Sometimes widgets will be in an obviously-named widgets.php, but other times you'll have to hunt for them. At some point, each widget has to be registered by calling register_widget. You can use the command line tool grep to find the register_widget call in the plugin/theme.

Sample grep syntax:

cd wp-content/plugins/pluginname
grep -r 'register_widget' .

If the machine you're on doesn't have grep, most IDEs also contain tools for searching through your code. Eclipse (multi OS), Textmate2 (OSX), and Notepad++ (Windows) are a few of my personal favorites. To that end, the more recent versions of OSX and Windows do a half-decent job of searching within files from right within Finder / Windows Explorer.

As far as getting a backtrace, xdebug is a very powerful tool for figuring out just what a page is doing. You can use remote debugging with one of the supported IDEs to really dive into your code.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.