[wp-trac] [WordPress Trac] #40958: force_balance_tags breaks Ninjaforms and probably other plugins that output html within js.
WordPress Trac
noreply at wordpress.org
Wed Sep 18 08:25:03 UTC 2024
#40958: force_balance_tags breaks Ninjaforms and probably other plugins that output
html within js.
--------------------------+---------------------------------
Reporter: programmin | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Shortcodes | Version: 4.7.4
Severity: normal | Resolution:
Keywords: | Focuses: ui, administration
--------------------------+---------------------------------
Comment (by wpteccho):
This worked for me
{{{
$form_content = apply_filters('the_content', '[ninja_form id=14]');
if (strpos($form_content, '[ninja_form') === false) {
// Only use force_balance_tags if the content doesn't contain the
Ninja Form shortcode
$balanced_content = force_balance_tags($form_content);
} else {
$balanced_content = $form_content; // Skip force_balance_tags for
forms
}
echo 'BALANCED:--' . $balanced_content . ' --END BALANCED. ';
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/40958#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list