WordPress Debug Theme

Yoast Debug ThemeWarning: major geekery ahead! Sometimes you need to see what’s wrong with a WordPress install, and you need to see it fast. I’ve had a set of hacks around for a while to do that, but finally started combining it into a WordPress Debug Theme. This theme is quite simple for now, as it only does a few things, but does them quite effectively.

The first thing it does, on the homepage of the blog you’ve activated it on, is show the most important constants for that blog (see this screenshot). It shows you the important URL’s, editor and memory settings etc.

On subpages it will show you something else: the page type, all the query vars that are set and the SQL query for that page. I’ve found that just doing a print_r or var_dump of $wp_query is hard to read, this theme tries to be a bit smarter about that, see these examples.

This theme also works in the preview, so that might be enough in a lot of cases. It also works great together with Donncha’s Theme Tester, as Alex Leonard mentioned in the comments. Be warned that you might want to remove this theme from live sites though!

So all you have to do to use this is download it, upload it to your server and activate it.

If you’re a developer this theme might come in handy sometimes, I’d love to know if you use it and what you’d add, maybe we can turn this into something super useful together.

49 Responses to WordPress Debug Theme

  1. Stephen R
    By Stephen R on 25 October, 2009

    Hi again. I don’t mean to spam your comments, but anyone interested in your debug theme might also be interested in my “Log Deprecated Calls” plugin: http://striderweb.com/nerdaphernalia/features/wp-log-deprecated-calls/

  2. Marty Thornley
    By Marty Thornley on 24 October, 2009

    This sounds like a great tool. But I actually was expecting something else – more like a theme debugger plugin. I have had a lot of clients that want to use some theme or other as a starting point and I have to hunt down all the missing hooks and missing statements.

    Just throwing an idea out there, for a plugin that would test a theme, allowing you click through each page and tell you what template is being used, then maybe lists all the standard hooks and lets you know what is missing and where. Maybe in the footer or something it would list all the template files in the theme and suggest improvements (missing 404.php, missing search.php, for example) Very similar to what this looks like, but testing the theme.

    Now THAT would be cool.

  3. Jeff Byrnes
    By Jeff Byrnes on 20 October, 2009

    AWESOME. Thanks!

  4. Stephen R
    By Stephen R on 20 October, 2009

    In WP 2.9 we’re gaining the ability to register a theme directory. With that in mind, it would be smart to turn this into a *plugin*, thus:

    1) A customized version of the Theme Tester plugin that includes your debug theme.
    2) Activating the plugin registers the Debug theme’s directory and activates it for the admin only.

    This is just a cleaner and easier way to use the combination of the two, and a natural extension of your idea. One thing to update, one thing to activate, not fuss no muss.

    (Especially as I can’t think of *any* circumstance where an admin would want the Debug Theme activated for regular visitors!)

    • Joost de Valk
      By Joost de Valk on 20 October, 2009

      Great idea, doing that soon!

  5. webxfun
    By webxfun on 19 October, 2009

    it is great,thanks

  6. Xaboom
    By Xaboom on 19 October, 2009

    Nice work man ! Awesome idea for a theme .

  7. Aaron
    By Aaron on 16 October, 2009

    It would be really great if you could dump the globals for $current_user, $current_blog, and $current_site also. (the last 2 are WPMU).

  8. mike
    By mike on 16 October, 2009

    How do I use this theme? Where do I add it? Thanks for the hard work.

  9. Darren
    By Darren on 15 October, 2009

    hehe I’ll enjoy messing around with this. Could be a cool idea to incorporate this into a normal theme, so site admins can at the click of a link, find out any problems with their site..

  10. Edward Caissie
    By Edward Caissie on 15 October, 2009

    This is definitely going on my “Look-See” list … thanks for releasing it!

  11. Foxinni
    By Foxinni on 15 October, 2009

    Nice work dude! Very good idea for a theme. Will keep this in mind as soon as stuff start going off the rails if you know what i mean. d:


  12. Verycheeky
    By Verycheeky on 15 October, 2009

    Will try this out on a few sites of mine that are acting slow and tired, thank you for taking the time to create this and help make wordpress ROCK! Cheers!

  13. Flow Interactive
    By Flow Interactive on 15 October, 2009

    Thanks for sharing I know this will come in useful!

  14. Gillian
    By Gillian on 15 October, 2009

    Awesomeness!!! Thanks for sharing!!

  15. Abban
    By Abban on 14 October, 2009

    That’s a fantastic idea! Thanks!

  16. Sepehr Lajevardi
    By Sepehr Lajevardi on 14 October, 2009

    You did it! thanks ;)

  17. Tony Dew
    By Tony Dew on 14 October, 2009

    GREAT idea! Thank you very much for this.

  18. Mark Marshall
    By Mark Marshall on 14 October, 2009

    What a cool idea. I have installed on one of my test sites. There is lots of info that I do not understand yet, but it will be fun to explore and learn.

    Thank you for taking the time to build and release this.


  19. webmasters_by
    By webmasters_by on 14 October, 2009

    Thank you very much! this a very useful thing!

  20. scribu
    By scribu on 14 October, 2009

    I would include at least the titles of the posts so that it’s easier to find out what you’re looking at.

    Neat ideea, by the way.

    • Joost de Valk
      By Joost de Valk on 14 October, 2009

      Yeah good idea, will do on single posts / pages :)

  21. Jessie
    By Jessie on 14 October, 2009

    Awesome theme! Helped me out at our site with a few things. Keep up the work!

  22. Robine
    By Robine on 14 October, 2009

    Fantastic ^^ I think a lot of WordPress users will find this very usefull!

  23. Abraham Vegh
    By Abraham Vegh on 14 October, 2009

    Awesome concept! Can’t wait to use this!

  24. Alex Leonard
    By Alex Leonard on 14 October, 2009

    Hey Joost,

    That’s a great idea – definitely going to check that out.

    Could work very well in tandem with Theme Tester by Donncha

    • Joost de Valk
      By Joost de Valk on 14 October, 2009

      Post updated :)

    • Joost de Valk
      By Joost de Valk on 14 October, 2009

      Hmm that’s a bloody good idea, will add that to the post :)

Check out our must read articles about Analytics