How to fix dynamic shortcodes in Query Loop blocks

We found one problem that sometimes dynamic shortcodes from different plugins don’t render anything in Query Loop. Problem here is that Query Loop and Query builder doesn’t get post context for shortcodes. This snippet will try to help

// Shortcode fix for Gutenberg
function greenshift_shortcode_renderer_filter($block_content, $block, $instance)
{
    $final = do_shortcode(wpautop($block_content));
    return $final;
}
add_filter('render_block_core/shortcode', 'greenshift_shortcode_renderer_filter', 10, 3);

Drop it inside functions.php of child theme or use Code snippet plugin

«
»