[wp-trac] [WordPress Trac] #58333: WordPress 6.2.1 Shortcodes some shortcode no longer works!

WordPress Trac noreply at wordpress.org
Wed May 17 23:26:01 UTC 2023


#58333: WordPress 6.2.1 Shortcodes some shortcode no longer works!
--------------------------+-----------------------
 Reporter:  jorcus        |       Owner:  (none)
     Type:  defect (bug)  |      Status:  reopened
 Priority:  normal        |   Milestone:  6.2.2
Component:  Shortcodes    |     Version:  6.2.1
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+-----------------------

Comment (by gimbalspinner):

 Replying to [comment:7 andergmartins]:
 > For those who want to stay on 6.2.1 and need to restore the support for
 shortcodes on templates, you can try this workaround.
 >
 > Add the following code as a plugin in a PHP file in the plugins folder:
 >
 > {{{#!php
 > <?php
 > /*
 > Plugin Name: Fix shortcode
 > Plugin URI:
 > Description: Restore shortcode support on block templates
 > Author: Anderson Martins
 > Version: 0.1.0
 > */
 >
 > add_filter('render_block_data', function($parsed_block) {
 >     if (isset($parsed_block['innerContent'])) {
 >         foreach ($parsed_block['innerContent'] as &$innerContent) {
 >             if (empty($innerContent)) {
 >                 continue;
 >             }
 >
 >             $innerContent = do_shortcode($innerContent);
 >         }
 >     }
 >
 >     if (isset($parsed_block['innerBlocks'])) {
 >         foreach ($parsed_block['innerBlocks'] as $key => &$innerBlock) {
 >             if (! empty($innerBlock['innerContent'])) {
 >                 foreach ($innerBlock['innerContent'] as &$innerContent)
 {
 >                     if (empty($innerContent)) {
 >                         continue;
 >                     }
 >
 >                     $innerContent = do_shortcode($innerContent);
 >                 }
 >             }
 >         }
 >     }
 >
 >     return $parsed_block;
 > }, 10, 1);
 >
 >
 > }}}
 >
 >
 > But be aware that support was removed for fixing a security issue, and
 restoring shortcode support you are probably bringing back the security
 issue.

 Activating this as a plugin has not fixed it unfortunately.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58333#comment:48>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list