Last active
November 24, 2022 10:10
-
-
Save butlerblog/b2919d61c0402269b0802117c511c387 to your computer and use it in GitHub Desktop.
#utility for finding callback functions hooked to a specific hook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // do not use this line. Add below to functions.php | |
add_action( 'wp_footer', 'list_hooked_filters_and_actions' ); | |
add_action( 'login_footer', 'list_hooked_filters_and_actions' ); | |
add_action( 'admin_footer', 'list_hooked_filters_and_actions' ); | |
function list_hooked_filters_and_actions() { | |
global $wp_filter; | |
$hook = 'login_form'; | |
if( empty( $hook ) || !isset( $wp_filter[$hook] ) ) | |
return; | |
echo '<div style="background-color:#D3D3D3;min-height:200px;">'; | |
echo '<h2>Callbacks hooked to "' . $hook . '"</h2><ul>'; | |
foreach( $wp_filter[ $hook ]->callbacks as $key => $priority ) { | |
foreach ( $priority as $callback => $details ) { | |
echo '<li>' . $details['function'] . ' priority: ' . $key . '</li>'; | |
} | |
} | |
echo '</ul></div>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment