Search code examples
phpwordpressfilter

WordPress: How do I get all the registered functions for 'the_content' filter


I have a question regarding WordPress, specifically version 3.0 and newer.

Does anyone know how to get an array or list of all the functions that will be applied or are 'registered' to the_content filter?

The idea is to generate a checkbox list of possible functions to remove from the filter, such as wpautop. I know how to remove functions from the filter with hard coded labels, but I am hoping to create a more dynamic solution.

If anyone has any ideas if this is possible and how it could be done I would be very interested. Thanks.


Solution

  • Simple function to print from the filter array?

    function print_filters_for( $hook = '' ) {
        global $wp_filter;
        if( empty( $hook ) || !isset( $wp_filter[$hook] ) )
            return;
    
        print '<pre>';
        print_r( $wp_filter[$hook] );
        print '</pre>';
    }
    

    Call it where you need it.

    print_filters_for( 'the_content' );