Skip to content

Instantly share code, notes, and snippets.

@thefuxia
Last active January 15, 2022 18:53
Show Gist options
  • Save thefuxia/867302 to your computer and use it in GitHub Desktop.
Save thefuxia/867302 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: Fuxia Scholz
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