[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 18:54:35 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:  needs-testing has-testing-info       |     Focuses:
  needs-unit-tests                               |
-------------------------------------------------+-------------------------

Comment (by 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:27>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list