Wordpress var_dump in functions.php

Try killing the flow right after the var_dump, that ussually helps me debug easier:

var_dump($types);
die("products_first_ends");

That way if something after your var_dump is rendering on top of the var dump it wont get covered by it.


shutdown hook can be used, add this code to functions.php:

function custom_dump($anything){
  add_action('shutdown', function () use ($anything) {
    echo "<div style='position: absolute; z-index: 100; left: 30px; bottom: 30px; right: 30px; background-color: white;'>";
    var_dump($anything);
    echo "</div>";
  });
}

Tags:

Php

Wordpress