Make WordPress Core

Opened 12 months ago

#58397 new defect (bug)

Shortcodes in patterns are not rendered in templates

Reported by: ryelle's profile ryelle Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.2.2
Component: Shortcodes Keywords:
Focuses: Cc:

Description

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 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.

Change History (0)

Note: See TracTickets for help on using tickets.