Using the dump() and dd() debug helpers in WordPress

dump() and dd() are two useful debug helpers available in the Laravel framework.

Both methods dump the given variables and the dd() method stops the script execution (dump and die).

The output information is similar to the one you can see with the var_dump() and print_r() functions, but with a good format.

Their usage is very simple:

dump($variable);
dd($variable);

And the output, as you can see in the image below, is very useful and readable:

If the variable is an array of objects or has some child elements, you can navigate through the output.

To use these two helpers in WordPress, you just have to install and enable this plugin.

And that’s all. In the screenshot below, you can see it in action in WordPress.

1 comment

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.