Skip to content

Instantly share code, notes, and snippets.

@CurtisL
Last active November 3, 2015 19:15
Show Gist options
  • Select an option

  • Save CurtisL/14c37565f1f166eb74a9 to your computer and use it in GitHub Desktop.

Select an option

Save CurtisL/14c37565f1f166eb74a9 to your computer and use it in GitHub Desktop.
formatted var dumps for quick debugging in wordpress
<?php
/**
* Dump and Die.
* Dumps all args passed and kills the script.
*/
function dd() {
$args = func_get_args();
array_map( function( $x ) {
dump( $x );
}, func_get_args() );
wp_die( '', 'Manual Dump And Die' );
die;
}
/**
* Dumps variable.
*
* @param mixed $var var to dump.
*/
function dump( $var ) {
echo '<small><pre><code>';
var_dump( $var );
echo '</code></pre></small>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment