[wp-trac] [WordPress Trac] #58397: Shortcodes in patterns are not rendered in templates

WordPress Trac noreply at wordpress.org
Wed May 24 18:37:48 UTC 2023


#58397: Shortcodes in patterns are not rendered in templates
--------------------------+-----------------------------
 Reporter:  ryelle        |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Shortcodes    |    Version:  6.2.2
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 When a pattern is used in a template (using the pattern block), the
 shortcode processing is not applied to the content inside the pattern. So
 if you have a shortcode in a pattern, it is not rendered.

 For example, a template could be:

 {{{
 <!-- wp:group {"tagName":"main"} -->
 <main class="wp-block-group">
         <!-- wp:pattern {"slug":"theme-name/shortcode-demo"} /-->
 </main>
 <!-- /wp:group -->
 }}}

 and the pattern:

 {{{
 <?php
 /**
  * Title: Demo
  * Slug: theme-name/shortcode-demo
  * Inserter: no
  */

 ?>
 <!-- wp:paragraph -->
 <p><?php _e( 'PHP version [recommended_php] or greater.', 'wporg' );
 ?></p>
 <!-- /wp:paragraph -->
 }}}

 Expected output: `PHP version 7.4 or greater.`

 Actual output: `PHP version [recommended_php] or greater.`

 This caused
 [https://wordpress.slack.com/archives/C02QB8GMM/p1684947553359749 an issue
 with the WordPress.org download page].

 This might be a duplicate of #58386, not sure if this should be handled
 differently for the pattern block vs 3rd party blocks.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58397>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list