[wp-trac] [WordPress Trac] #54759: Shortcodes are not working in page templates in the new "Beta" editor
WordPress Trac
noreply at wordpress.org
Fri Jan 7 09:08:12 UTC 2022
#54759: Shortcodes are not working in page templates in the new "Beta" editor
----------------------------+-----------------------------
Reporter: nextend_ramona | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: trunk
Severity: normal | Keywords:
Focuses: |
----------------------------+-----------------------------
The shortcode block does not transform the shortcodes in the page template
of the new "beta" editor (located at Appearance > Editor (beta)) of the
full site editing when the shortcode is added to the "content" area, not
into the "Header" or "Footer". (It works fine from these two.)
For testing I created a new plugin which only contains the following code:
{{{#!php
<?php
add_shortcode('note', 'tt_test_note');
function tt_test_note($atts, $content = null) {
ob_start();
?>
<div class="note" style="margin: 30px 0; padding: 27px 40px;
background: #fcf3dc; border-radius: 5px;">
<p><?php echo $content; ?></p>
</div>
<?php
return ob_get_clean();
}
}}}
== Result ==
New “beta” editor: https://imgur.com/o4bPPa6
Page content: https://imgur.com/9j3gusE
Frontend: https://imgur.com/576sFam
== Environment ==
1. WordPress 5.9-RC1-52464
2. Active theme: Twenty Twenty-Two Version: 1.0
3. Active plugins: only the shortcode plugin that has the code above and
nothing else
4. PHP: 7.2.34-28+ubuntu18.04.1+deb.sury.org+1
== What’s the issue? ==
When using the shortcode {{{[note]test[/note]}}} in Gutenberg’s own
shortcode module works in the actual page, but not in the new "beta" full
site editor's "content" area. (I'm sorry, I'm not sure what that is called
exactly.) The shortcode works fine from the "Header" and "Footer" area,
just not between them.
== Steps to reproduce ==
1. Create a new plugin and add the code mentioned above
2. Go to Appearance > Editor
3. Click on the WordPress icon at the left site
4. Select Templates > Page
5. Add a new shortcode block above Post title (https://imgur.com/5lFPgtE)
6. Write this code there: {{{[note]test[/note]}}}
7. Save the template
8. Create a new page
9. Add a new shortcode block and write the same shortcode there
(https://imgur.com/5lFPgtE)
10. Save the page and check it
You’ll see the {{{[note]test[/note]}}} code is displayed above the post
title, but the yellow block shows correctly up below.
https://imgur.com/orEyhvI
I've also opened a post in the alpha-beta forums:
https://wordpress.org/support/topic/shortcodes-are-not-working-in-page-
templates/
--
Ticket URL: <https://core.trac.wordpress.org/ticket/54759>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list