PHIL KURTH

Email

Dump defined variables for a quick look at what’s available in the current context

Templating in WordPress is pretty easy, right? There are loads of template functions and most things are pretty well document but every now and then it’s just nice to see exactly what variables you have at your fingertips.

All it takes a simple one-liner to do exactly that:

The above will dump an array of variables that you have available to you. The variable names are the keys and the value are…well….the values!

You might not see this in a nicely formatted way, however. If that is the case, simply wrap that baby up in some <pre> tags and you should be good to go:

One last thing…

If you liked this article, I'd be incredibly grateful if you tweeted about it.

Also, I don't send emails often but when I do, I try to fill them full of useful goodies. If you like code snippets & dev tips, join my mailing list. There's no catch but I'll probably want to tell you about any new plugins & tools I build.