Skip to content

Instantly share code, notes, and snippets.

@oxyc
Last active December 12, 2022 21:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oxyc/dc646e094e1096972f17422052e87a6b to your computer and use it in GitHub Desktop.
Save oxyc/dc646e094e1096972f17422052e87a6b to your computer and use it in GitHub Desktop.
diff --git a/pro/blocks.php b/pro/blocks.php
index 8f02e8d..4ac127b 100755
--- a/pro/blocks.php
+++ b/pro/blocks.php
@@ -910,8 +910,14 @@ function acf_ajax_fetch_block() {
$content = '';
$is_preview = true;
+ $parent = WP_Block_Supports::$block_to_render;
+ $block['blockName'] = $block['name'];
+ WP_Block_Supports::$block_to_render = $block;
+
// Render and store HTML.
$response['preview'] = acf_rendered_block( $block, $content, $is_preview, $post_id, null, $context );
+
+ WP_Block_Supports::$block_to_render = $parent;
}
// Send response.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment