[wp-trac] [WordPress Trac] #58366: Shortcode Support Regained but Content Filters are messing with Shortcode HTML
WordPress Trac
noreply at wordpress.org
Mon May 22 15:18:36 UTC 2023
#58366: Shortcode Support Regained but Content Filters are messing with Shortcode
HTML
---------------------------+------------------------------
Reporter: domainsupport | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Shortcodes | Version: 6.2.2
Severity: normal | Resolution:
Keywords: | Focuses:
---------------------------+------------------------------
Comment (by davidsjptimoney):
Another use case. Our site is for a non-profit film club. We use
Eventbrite for ticketing, specifically their Embedded Checkout modal,
which looks like this:
{{{
<!-- Noscript content for added SEO -->
<noscript><a
href="https://www.eventbrite.co.uk/e/aftersun-12-tickets-590034829057"
rel="noopener noreferrer" target="_blank">Buy Tickets on
Eventbrite</a></noscript>
<!-- You can customise this button any way you like -->
<button id="eventbrite-widget-modal-trigger-590034829057"
type="button">Buy Tickets</button>
<script
src="https://www.eventbrite.co.uk/static/widgets/eb_widgets.js"></script>
<script type="text/javascript">
var exampleCallback = function() {
console.log('Order complete!');
};
window.EBWidgets.createWidget({
widgetType: 'checkout',
eventId: '590034829057',
modal: true,
modalTriggerElementId: 'eventbrite-widget-modal-
trigger-590034829057',
onOrderComplete: exampleCallback
});
</script>
}}}
This is held in an ACF field for the film (a post). After the 6.2.2 fix,
this is parsed and the line-feeds & carriage returns replaced with <br>
and <p>.
To work around this, we've had to add extra code to the PHP snippet that
pulls the ACF field and customises the button. Thus:
{{{
$searchf = array("\n","\r");
$content = str_replace($searchf,"",$content);
}}}
The other thing we noticed was that a table cell that wasn't properly
closed (i.e. <tr><td></tr> instead of <tr><td></td></tr>) got a </p>
injected, which caused layout issues.
We use a customised twenty-twenty theme (not a child theme). Some of our
site fell over with 6.2.1 but we got round that by encapsulating the
shortcodes in the template within template parts, though I'm not clear if
that is a sutainable solution, to judge from some of the other comments
I've seen on here.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58366#comment:20>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list