Display WordPress Hook Functions



wordpress-hooks

If you are WordPress Developer, Themes Developer or Plugin Developer, you will enjoy this functions, this code original made by Rast and was published on WP Recipes. This function is perfect for me, because with this little code we can display all WordPress Hook available and we can play around with it.

Why we need learn WordPress hooks? because  are very useful because they allow you to “surcharge” an existing WP function with your own code.

Here is the Code

function list_hooked_functions($tag=false){
global $wp_filter;
if ($tag) {
$hook[$tag]=$wp_filter[$tag];
if (!is_array($hook[$tag])) {
trigger_error("Nothing found for '$tag' hook", E_USER_WARNING);
return;
}
}
else {
$hook=$wp_filter;
ksort($hook);
}
echo '<pre>';
foreach($hook as $tag => $priority){
echo "<br />>>>>>t<strong>$tag</strong><br />";
ksort($priority);
foreach($priority as $priority => $function){
echo $priority;
foreach($function as $name => $properties) echo "t$name<br />";
}
}
echo '</pre>';
return;
}

And here is how to use it

list_hooked_functions()

I hope you enjoy our today WordPress Tips, you can read more details about WordPress API


Subscribe to Full RSS Feed

RSS FeedIf you thing this article useful, please consider subscribing to our RSS Feed or e-mail updates and stay updated with us. You can also follow @JauhariNET on twitter for latest updates.


About Jauhari

This is me Nurudin Jauhari. Just human like you, I come from Gunungkidul, small place at Yogyakarta, and Today I live at Malang I was born 30/04/1980 in Ponjong, small village in Gunungkidul, Almost my time in 1 - 15 Years stay at this Village. More

This entry was posted in WordPress Code and tagged , , , .
Bookmark the permalink.



4 Responses to Display WordPress Hook Functions

  1. This function owns. Exactly what I was looking for. Thank you so much!

  2. ganda says:

    It was a great script sir. I learn a new function here, that is trigger_error() function. This script would help me much if i forgot which wordpress function i’ve ever modified using add_filter().

    Thank you so much sir.. :)

  3. Pingback: Nurudin Jauhari 

  4. Pingback: Nurudin Jauhari

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>