This plugin conflicts with wpautop (line breaks added on pages)
-
There is an issue with this plugin adding the filter ‘wpautop’ to ‘the_content’ in shortcodes.php.
The problem is two-fold.
Problem #1
If another plugin which manages/disables wpautop has removed the filter prior to this plugin running then this plugin will re-enable the filter anyway breaking the other plugin’s functionality.
The solution here needs to be a check at the beginning of shortcodes.php to see if the filter exists in the first place. At the end of the file, where the filter is re-enabled there needs to be a conditional check based on the initial state before re-enabling the filter.
i.e At the beginning:
//Turn editor auto format off
$wpautop_on = has_filter('the_content', 'wpautop');
if ($wpautop_on) {
remove_filter( 'the_content', 'wpautop' );
}
At the end:
//Turn auto format back on
if ($wpautop_on) {
add_filter( 'the_content', 'wpautop');
}
Problem #2
When you re-enable the wpautop filter at the end of the shortcodes.php file, you are adding it with priority 12. However the default filter in wp-includes/default-filters.php is at default priority, i.e. priority 10. Again, this breaks any other code that assumes this filter is at 10 or that has a legitimate reason to change the filter’s priority to something else.
So, actually the add_filter line should look as follows to preserve the priority:
`add_filter( ‘the_content’, ‘wpautop’, (is_int($wpautop_on) ? $wpautop_on : 10));I would kindly ask if you could ensure that this, or a similar fix is added to the next release of the plugin.
Regards,
Andy Brennenstuhl at The Webists
- The topic ‘This plugin conflicts with wpautop (line breaks added on pages)’ is closed to new replies.