<?php
body_class(); ?>>
<div id="page" class="site">
<div id="content" class="site-content">
<?php
$registry = WP_Block_Type_Registry::
get_instance();
$block =
$registry->
get_registered( 'core/legacy-widget'
);
echo $block->
render( $_GET['legacy-widget-preview'
] );
?>
</div><!-- #content -->
</div><!-- #page -->
<?php
wp_footer(); ?>
</body>
</html>
<?php
exit;
}// Use admin_init instead of init to ensure get_current_screen function is already available.
// This isn't strictly required, but enables better compatibility with existing plugins.
// See: https://github.com/WordPress/gutenberg/issues/32624.
add_action( 'admin_init', 'handle_legacy_widget_preview_iframe', 20
);