[wp-trac] [WordPress Trac] #58333: WordPress 6.2.1 Shortcodes some shortcode no longer works!
WordPress Trac
noreply at wordpress.org
Thu May 18 02:13:29 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 EmpireOfLight):
Replying to [comment:48 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.
Doesn't work for me either on a TT3 child theme using a basic ACF
shortcode. Turning on WP_DEBUG doesn't show any errors.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58333#comment:50>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list