Skip to content

Instantly share code, notes, and snippets.

@lotharthesavior
Last active March 25, 2021 17:28
Show Gist options
  • Save lotharthesavior/632808c7e5b603b44c4c9f692d743fdb to your computer and use it in GitHub Desktop.
Save lotharthesavior/632808c7e5b603b44c4c9f692d743fdb to your computer and use it in GitHub Desktop.
WordPress - show registered filters for hooks
<?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' )));
@lotharthesavior
Copy link
Author

This function needs to be called after the output buffer starts, in other words, the best place would be a theme file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment