Some users of the Downline Builder Plugin may notice that shortcode content can occasionally break due to WordPress’s default wpautop
function. This function automatically inserts paragraph (<p>
) and line break (<br />
) tags, which can interfere with shortcode output.
Here’s a quick fix you can add to your theme’s functions.php
file (or a custom plugin) to ensure your shortcodes display correctly:
function wpex_fix_shortcodes($content) {
return strtr($content, [
'<p>[' => '[',
']</p>' => ']',
']<br />' => ']'
]);
}
remove_filter('the_content', 'wpautop');
remove_filter('the_content', 'do_shortcode', 11);
add_filter('the_content', 'wpautop', 100);
add_filter('the_content', 'wpex_fix_shortcodes', 105);
add_filter('the_content', 'do_shortcode', 110);
This snippet:
✅ Removes the default wpautop
and do_shortcode
filters temporarily
✅ Adds a new filter (wpex_fix_shortcodes
) to correct the shortcode wrapping
✅ Re-applies the filters in a way that ensures shortcodes display as intended