Last active
December 28, 2020 12:16
-
-
Save vishalkakadiya/ac70e878ece40ce9be7cfd9e916dad66 to your computer and use it in GitHub Desktop.
Get list of function names which is hooked available on particular 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 | |
/** | |
* Change `the_content` thing in below function with your hook in filter | |
* - You can change $wp_filter to $wp_actions to get details of action hooks. | |
* | |
* NOTE: THIS IS FOR ONLY DEBUG PURPOSE NOT SEND THIS CODE TO PRODUCTION. | |
*/ | |
function vk_list_hooks() { | |
global $wp_filter; | |
$functions = []; | |
foreach ( $wp_filter['the_content']->callbacks as $callbacks ) { | |
foreach ( $callbacks as $callback ) { | |
if ( isset( $callback['function'] ) && ! empty( $callback['function'] ) ) { | |
$callback_function = $callback['function']; | |
if ( is_string( $callback_function ) ) { | |
$functions[] = $callback_function; | |
} | |
} | |
} | |
} | |
echo '$functions: <pre>'; | |
print_r( $functions ); | |
echo '</pre>'; | |
die; | |
} | |
add_action( 'wp', 'vk_list_hooks', 999 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment