Skip to content

Instantly share code, notes, and snippets.

@bryanwillis
Forked from thefuxia/list-comment-filters.php
Created January 14, 2016 07:31
Show Gist options
  • Save bryanwillis/f690c94ab53a80293204 to your computer and use it in GitHub Desktop.
Save bryanwillis/f690c94ab53a80293204 to your computer and use it in GitHub Desktop.
WordPress Plugin: List Comment Filters
<?php
/*
Plugin Name: List Comment Filters
Description: List all comment filters on wp_footer
Version: 1.1
Author: Thomas Scholz
Author URI: http://toscho.de
License: GPL v2
*/
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";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment