Add backtrace details to _doing_it_wrong output
|Reported by:||chrisjean||Owned by:|
The _doing_it_wrong function is great for notifying that there is a problem, but it doesn't do much to help find out where the problem originates. I made a first stab at adding some backtracking information and have the proposed patch attached.
It outputs something like the following:
Notice: wp_enqueue_script was called <strong>incorrectly</strong>. Scripts and styles should not be registered or enqueued until the <code>wp_enqueue_scripts</code>, <code>admin_enqueue_scripts</code>, or <code>init</code> hooks. (This message was added in version 3.3.) (Called by wp-content/plugins/bad-plugin/bad-plugin.php line 23) in wp-includes/functions.php on line 3523
Please try it out, and let me know if any modifications need to be made for specific cases. I'm open to completely changing the way the information is presented, I just want to be able to know from where the issue originated so that I can quickly track it down as it often shows up when I activate other developer's code.