Monitor and Fix Incorrectly Coded Content Filters

I’ve just released version 1.1.0 of JSM’s Block Filter Output – a new plugin to monitor the content filter and fix incorrectly coded filter hooks (that send text to the webpage instead of returning it, as all filter hooks must).

A notice is also sent to the PHP error log when webpage output is detected:

[01-Oct-2017 01:48:28 UTC] Block Filter Output: The “ClassName::echoText” filter hook with priority 10 in the “the_content” filter has mistakenly provided some webpage output. All WordPress filter hooks must return their text – not send it to the webpage output. Please contact the author of that filter hook and report this issue as a coding error / bug. Incorrect webpage output:
—BEGIN—
<strong>Some output that should have been returned instead of echo’ed.</strong>
—END—

The plugin is fully tested and compatible with PHP v7.x (PHP v5.3 or better required).

Power-users / Developers

If you haven’t enabled the WP_DEBUG constant yet, you should set the WP_DEBUG constant to true in your wp-config.php file to find out about these and any other PHP / WordPress coding errors. 😉

The plugin only monitors the “the_content” filter by default. You can customize the list of monitored filters by defining the JSM_BFO_FILTER_NAMES constant.

You can also monitor the special WordPress “all” filter, although this is not recommended as it this may have a negative effect on you site’s performance:

Plugins Using the BFO Library

The WPSSO Core plugin uses the BFO library when the “Use WordPress Content Filters” option is enabled in its Advanced settings page.

Find this content useful? Share it with your friends!