Open MaggieCabrera opened 10 months ago
I was able to reproduce it. I've tested it with multiple third-party blocks, but conditional read doesn't seem to work.
Create a pattern like below in test/emptytheme/patterns/test.php
<?php
/**
* Title: Starscape
* Slug: test/starscape
*/
?>
<?php if ( WP_Block_Type_Registry::get_instance()->is_registered( 'a8c/starscape' ) ) : ?>
<!-- wp:paragraph -->
<p>My starscape block is registered.</p>
<!-- /wp:paragraph -->
<?php else : ?>
<!-- wp:paragraph -->
<p>My starscape block is NOT registered.</p>
<!-- /wp:paragraph -->
<?php endif ?>
Description
Blocks are not registered when creating a block pattern, so we can no longer conditionally load blocks depending on if they are registered or not. If something has changed and this is no longer possible, we should update the handbook.
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
This is the code that should go inside the pattern file
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes