Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
This function displays the hooks attached on a filter so you can see what's messing you up!
<?php
function viper_debug_filter( $filter ) {
add_filter( $filter, function( $value ) {
global $wp_filter;
$filters = array();
foreach ( (array) $wp_filter[ current_filter() ]->callbacks as $priority => $functions ) {
foreach ( (array) $functions as $function => $args ) {
$filters['Priority ' . $priority][] = $args;
}
}
var_dump( current_filter(), $filters );
return $value;
} );
}
// Pass the filter name here
viper_debug_filter( 'the_content' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.