Actions zijn eigenlijk filters en filters worden bewaard in een globale variabele. Deze variabele kun je uitlezen.
Aanpak: een functie die de variabele print. Deze haken (hook) we aan een actie in de footer.
add_action( 'wp_footer', 'list_comment_filters' ); function list_comment_filters() { global $wp_filter; $comment_filters = array (); $h1 = '<h1>Current Comment Filters</h1>'; $out = ''; $toc = '<ul>'; foreach ( $wp_filter as $key => $val ) { if ( FALSE !== strpos( $key, 'comment' ) ) { $comment_filters[$key][] = var_export( $val, TRUE ); } } foreach ( $comment_filters as $name => $arr_vals ) { $out .= "<h2 id=$name>$name</h2><pre>" . implode( "\n\n", $arr_vals ) . '</pre>'; $toc .= "<li><a href='#$name'>$name</a></li>"; } print "$h1$toc</ul>$out"; }
Leave a Reply