WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

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.

share|improve this answer
Thanks for the reply Kelly, – Josh Smith Jun 17 '13 at 20:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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