Last active
March 25, 2021 17:28
-
-
Save lotharthesavior/632808c7e5b603b44c4c9f692d743fdb to your computer and use it in GitHub Desktop.
WordPress - show registered filters for hooks
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 | |
function show_registered_filters( $hook = '' ) { | |
global $wp_filter; | |
if( empty( $hook ) || !isset( $wp_filter[$hook] ) ) | |
return; | |
echo '<pre>'; | |
foreach ( $wp_filter[$hook]->callbacks as $item ) { | |
foreach ( $item as $item2 ) { | |
var_dump( $item2['function'][0] ); | |
var_dump( $item2['function'][1] ); | |
echo "\n\n"; | |
} | |
} | |
echo '</pre>'; | |
} | |
wp_die(var_dump(show_registered_filters( 'tec_cart_item_data_variation' ))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This function needs to be called after the output buffer starts, in other words, the best place would be a theme file.