[wp-trac] [WordPress Trac] #58366: Shortcode Support Regained but Content Filters are messing with Shortcode HTML
WordPress Trac
noreply at wordpress.org
Wed Nov 8 17:49:19 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: 6.5
Component: Shortcodes | Version: 6.2.2
Severity: normal | Resolution:
Keywords: needs-testing has-testing-info | Focuses:
needs-unit-tests has-patch |
-------------------------------------------------+-------------------------
Comment (by domainsupport):
Replying to [comment:63 giorgosm]:
> Can i ask which is the working hack for this? Thank you
We use the below fix in our Options for Block Themes plugin ...
Replying to [comment:27 bekk]:
> I haven't been able to come up with a simple enough patch that doesn't
cause side effects. For anyone needing a temporary workaround mine is
below it excludes the wpautop'ing for only the shortcode block, also
@tdrayson's works too with the caveat that the shortcode is <p>'d
>
> {{{#!php
> <?php
> add_filter('register_block_type_args', function ($settings, $name) {
> if ($name === 'core/shortcode') {
> $settings['render_callback'] = function ($attributes,
$content) {
> return $content;
> };
> }
> return $settings;
> }, 10, 2);
> }}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58366#comment:64>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list