WP-Debug

WP-Debug Screenshot

WP-Debug Screen­shot

Web­De­vS­tu­dio has cre­ated WP-Devel which uses the foun­da­tion of WP-Debug and has added enhance­ments. I’m no longer updat­ing WP-Debug but instead point­ing to their work.

I was using my Stum­ble­Upon, and I came across Krumo which is a PHP debug­ging appli­ca­tion. It allows you to see the con­tent of server vari­ables, cook­ies, and a lot more includ­ing spec­i­fied vari­ables such as $wp_query! After a short while I had a run­ning Word­Press plu­gin which should be an asset for Word­Press developers.

Instal­la­tion

  1. Down­load, upload, activate.

That’s it! As long as you’re logged in you’ll see the expand­able menus in the footer of your page (noth­ing is shown to your vis­i­tors). It does rely on hav­ing the wp_footer() call in your theme so ensure that’s there if you don’t see anything.

Con­fig­u­ra­tion

Krumo comes with some default styles: default, blue, green, orange, and scablon.com. It is set to default which works the best with the default Word­Press theme. If you would like to change it you can go to the “krumo” folder of the plu­gin and edit the “selected” value in the krumo.ini file (you might have to adjust the styles depend­ing on how CSS inher­i­tance from your theme throws things off).

[skin]
selected = "default"

I have most of the Krumo API in the plu­gin, but you can add/remove at your lesiure. If you want to check a vari­able then sim­ply add to lines 14, but you can see on line 14 that I had to declare Word­Press vari­ables as global, because the con­tent is out­side the loop. Sim­ply add a global vari­able to line 12 if needed.

global $user_ID, $wp_query, $wp;
if ( $user_ID ) {
include ('krumo/class.krumo.php');

Be sure to check the doc­u­men­ta­tion for their API if need be.


21 Comments

  1. Hi There Chris -
    This looks at a great plug-in… thank you very much. I recently ran into some slow-loading page issues for my Word­Press web­sites and tried a bunch of things to address the issue(s) (see forum post at http://wordpress.org/support/topic/141011).

    I plan to blog about your plu­gin at OpenSourceWebMaster.com. Do you have a dona­tion but­ton for your plu­gin?
    – Scott

    Scott Frangos on 11.04.07
  2. @Scott: I’m glad you liked it, and thanks for the pub­lic­ity. I added a dona­tion but­ton above, and I also have a link for it.

    Chris Poteet on 11.05.07
  3. Acti­vated ver­sion wp-debug 1.0 on WP2.3.1, and get the fol­low­ing error at the bot­tom of pages.

    Fatal error: Call to unde­fined func­tion: getall­head­ers() in /wp-content/plugins/wp-debug/krumo/class.krumo.php on line 260

    Still dig­ging into it, but curi­ous if you have heard of oth­ers run­ning into this.

    GM on 11.17.07
  4. @GM: If you com­ment that par­tic­u­lar func­tion on line 26 of wp-debug.php do you get any other errors? I’m guess­ing it’s asso­ci­ated with your server.

    Chris Poteet on 11.17.07
  5. Com­ment­ing out line 26 worked. What func­tion­al­ity am I miss­ing with it removed?

    GM on 11.18.07
  6. @GM: You’ll won’t get the PHP header infor­ma­tion (what browser you are using, etc). Not critical.

    Chris Poteet on 11.18.07
  7. I am glad that you took my lit­tle project Krumo to such good use!

    Kaloyan K. Tsvetkov on 02.06.08
  8. @Kaloyan: Thank you for mak­ing it possible!

    Chris Poteet on 02.06.08
  9. Hi Chris,

    thanks for the great plu­gin. I was always look­ing for such struc­tured infor­ma­tion for debug­ging purposes.

    I did some mod­i­fi­ca­tions to the plu­gin code and also to the krumo class itself. If you are inter­ested in this code, I would be happy to share this.

    I did the fol­low­ing changes:
    – Krumo out­put is now also dis­played on the admin pages of Word­Press
    – A devel­oper can call the debug func­tions itself. In this case it is assumed that she would like only to see the requested infor­ma­tion. The pre­de­fined bunch of krumo calls are skipped in this case
    – If a devel­oper calls the debug func­tion itself, the out­put will also go to the footer of the page
    – Kru­mos recur­sion detec­tion wasn’t acu­tally a recur­sion detec­tion but a ref­er­ence detec­tion. This lead to more recur­sion warn­ings as necessary

    Sören on 04.05.08
  10. @Soren: I just sent you an e-mail. Please do share.

    Chris Poteet on 04.05.08
  11. Hello Chris,

    I am look­ing for a way to do debug out­put dur­ing ajax calls. Would your plu­gin allow that?

    Vladimir on 04.09.08
  12. @Vladimir: I would sug­gest using Fire­bug for that.

    Chris Poteet on 04.09.08
  13. Thanks Chris

    Do you know of a way to call firebug’s console.log from a php function?

    Vladimir on 04.09.08
  14. @Vladimir: Not with PHP that I know of. You can try FirePHP, but I’ve never got­ten it to work.

    Chris Poteet on 04.09.08
  15. I am puz­zling with idea to make a debug plu­gin that will allow real time debug­ing from anywhere.

    you would open a new browser win­dow and point it to a debug server which will receive infor­ma­tion from your plu­gin or what­ever in real­time. Have time for that? :)

    Vladimir on 04.09.08
  16. @Vladimir: Sorry, I don’t have any inter­est. I will how­ever be releas­ing a new ver­sion of WP-Debug soon, but it still won’t address your needs.

    Chris Poteet on 04.10.08
  17. Hi, I acci­den­tally installed this on my PHP4 host­ing ser­vice and found noth­ing in my WP install worked. All fail­ing look­ing for the debug_print_backtrace() func­tion. In your btev.php mod­ule you call this twice, but you only check for it’s exis­tence in the first one. Fix­ing it was a sim­ple mat­ter of copy­ing the code block from the first call (lines 1054–1065) over the sec­ond call (from line 1108).

    David Edwards on 05.18.08
  18. @David: What line is this in? Is it in the Krumo class?

    Chris Poteet on 05.21.08
  19. My apolo­gies, it’s in btev.php which is part of the blue­trait event viewer plu­gin, not yours.

    David Edwards on 05.25.08
  20. Run­ning Word­press 2.9.2, I down­loaded, uploaded and acti­vated and noth­ing shows up… any­where. I checked the page source, I checked the footer and noth­ing is show­ing, not even an error.

    Brett on 03.10.10
  21. I no longer main­tain this plu­gin. WP-Devel has taken its place http://wordpress.org/extend/plugins/wp-devel/

    Chris Poteet on 03.10.10

Got Something to Say?

(Required)
(Required)