Created
September 3, 2018 19:50
-
-
Save hgezim/b9f6390120ddc1b586edae941771ece0 to your computer and use it in GitHub Desktop.
This function displays the hooks attached on a filter so you can see what's messing you up!
This file contains 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 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