Does anyone know a hook, which doesn't depend on the template. A hook I can rely on in any situations?

there's some debug data collected while loading pages (i'm using 'all' hook to collect filter names) i would like to log to the screen. i need the data displayed, say, before





Use the shutdown hook. It runs very late-- "just before PHP shuts down execution" per comments in the source.

Proof of concept:

add_action( 'shutdown', 
  function() {
    echo 'This runs very late in the page load';
  • Oh, I was just thinking about it, actually. Hope it won't cause an infinite loop. Maybe it would be good to hook var_dump into it. – Alex Herrmann Oct 3 '13 at 21:31
  • It is almost always possible to cause an infinite loop. You just have to put your mind to it. :) But whether or not you do cause an infinite loop depends on the code you use in the callback. – s_ha_dum Oct 3 '13 at 21:33
  • Yep, at least if i use just var_dump, there's no infinite loop. Works great! Thank you! – Alex Herrmann Oct 3 '13 at 21:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.