Patterns from the directory fail to render on the frontend when added directly to template files.
The issue involves patterns from the pattern directory not rendering on the frontend when added directly to template HTML files, despite showing correctly in the editor. The problem appears to be related to how templates are saved and rendered, potentially involving database interactions or template rendering logic. Further investigation is needed to pinpoint the exact cause.
I encountered this in a custom theme but I can also reproduce it with Twenty Twenty-Four, with no plugins installed. I only tested on WP 6.6.1.
Twenty Twenty-Four enables these two patterns from the pattern directory in theme.json:
"patterns": [
"three-columns-of-services",
"clients-section"
],
The theme then uses the clients section pattern inside twentytwentyfour/page-about-business.
When I create a new page and select the "About" business pattern, the remote pattern displays correctly in both the editor and front.
But if I edit a template HTML file and include the clients section or any other pattern from the pattern directory, the pattern only shows in the editor.
These example instructions uses Twenty Twenty-Four, but it can be reproduced in other block themes.
define( 'WP_DEVELOPMENT_MODE', 'theme' ); For example in wp-config.php.<!-- wp:pattern {"slug":"clients-section"} /--> No response
WordPress 6.6.1.
Claim this issue to let others know you're working on it. You'll earn 20 points when you complete it!