How to include block style variations for blocks in posts dynamically rendered via the Interactivity API

Block variation styles are parsed and processed through wp_render_block_style_variation_support_styles(). This is marked as private and thus should not be called by third-party code outside WordPress core. This function is called by virtue of being hooked into the render_block_data hook.

Thus, if you have a subset of known block structures that may appear, you could consider running some block renders somewhere. These renders would not pass their output anywhere but only specifically for their side effects, one being to generate their required block style variations.

You could create the block markup as a string and then use do_blocks() to render them:

do_blocks(
  <<<HTML
  <!-- wp:paragraph {"className":"is-style-foo"} -->
  <p class="is-style-foo">Render this style for its side effects.</p>
  <!-- /wp:paragraph -->
  HTML
);

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)