How do I isolate the reason a wordpress filter is not running?

I have a wordpress filter defined in my theme’s single.php:

header( ‘X-Filter-1: here’ );
add_filter( ‘the_content’, function( $content ) use ( $details ) {
header( ‘X-Filter-2: here’ );
/* lots of details removed so I can focus on this problem */
});

My X-Filter-1 debugging header shows up. My X-Filter-2 debugging header does not show up.

If I add an all action:

if (array_key_exists(‘dbg’, $_REQUEST) and preg_match(‘/trace.actions/’, $_REQUEST[‘dbg’])) {
$staging_trace_debug_tags = array();
add_action(‘all’, function ($tag) {
global $staging_trace_debug_tags;
if (in_array($tag, $staging_trace_debug_tags)) {
return;
}
echo “<pre class=”dbg-trace”>$tag</pre>”;
$staging_trace_debug_tags[] = $tag;
});
}

I can use that to see that the the_content filter is being run. So that much is good.

Has anyone seen this before, where a filter callback instance does not get run?

Are there any stupid things I might be overlooking that could cause this behavior?

How does one isolate a problem of this nature?

Read more here:: How do I isolate the reason a wordpress filter is not running?

Leave a Reply

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