[wp-hackers] debugging a wordpress hook

Mike Schinkel mikeschinkel at newclarity.net
Wed Mar 17 13:07:24 UTC 2010


Hi Uwiuw,

On Mar 17, 2010, at 8:49 AM, Uwiuw Bakawan.com wrote:
> i'm and my friend have this kind of weird question. Is there any way to hook a debug function into a hook such as 'init' and retrieve every php function's name whose operates on this particular hook ?


If I understand your question, you don't need a hook you just need this:

<?php 
/*
Template Name: Hook Dump
*/
header('Content-type:text/plain');
var_dump($GLOBALS['wp_filter'][$_GET['hook']]); 
?>

Save this page template, create a page called "debug" that uses it, and then you can check any hook you want via a URL parameter, i.e.:

http://example.com/debug/?hook=init

HTH.

-Mike


More information about the wp-hackers mailing list