Hi there,
dynamic shortcodes won’t work inside the Query Loop, the same goes for the core query loop block, theres some limitations within Gutenberg.
Instead of using a shortcode you can use the render_block
filter hook to replace the blocks content.
Here an example:
add_filter( 'render_block', function( $block_content, $block ) {
if ( ! empty( $block['attrs']['className'] ) && 'your-class' === $block['attrs']['className'] ) {
$block_content = 'return your content here';
}
return $block_content;
}, 10, 2 );
So you can add a block eg. a Headline Block, give it a CSS class in the advanced tab.
In the code above swap your-class
for that class name.
And that method will pass the current post ID.