I want to apply this filter from this question.

add_filter( 'the_content', 'pre_content_filter', 0 );

function pre_content_filter( $content ) {
    return preg_replace_callback( '|<pre.*>(.*)</pre|isU' , 'convert_pre_entities', $content );
}

function convert_pre_entities( $matches ) {
    return str_replace( $matches[1], html_entity_decode( $matches[1] ), $matches[0] );
}

But it seems there is no effect. So I want to check if the function pre_content_filter is really applied. How can I do it?

I’ve tried debug-bar and debug-bar-extender, but I couldn’t find if I can do it.

2 Answers
2

You can use has_filter() to check for registered filers.

Example:

add_filter( 'the_content', function( $content ) 
{
    if ( has_filter( 'the_content', 'pre_content_filter' ) )
        return 'pre_content_filter() is active<br>' . $content;

    return $content;
}, -1 );

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *