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

WordPress Trac noreply at wordpress.org
Wed May 17 00:42:42 UTC 2023


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

Comment (by 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['innerBlocks'])) {
         foreach ($parsed_block['innerBlocks'] as $key => &$innerBlock) {
             if (! empty($innerBlock['innerContent'])) {
                 foreach ($innerBlock['innerContent'] as &$innerContent) {
                     $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.

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


More information about the wp-trac mailing list