diff --git a/src/Block.php b/src/Block.php index 662a8cf7..566cac0d 100644 --- a/src/Block.php +++ b/src/Block.php @@ -782,8 +782,10 @@ public function render($block, $content = '', $preview = false, $post_id = 0, $w ->filter(fn ($value) => filled($value) && $value !== ';'); if (! is_admin() && method_exists($this, 'assets')) { - add_action('enqueue_block_assets', function () { - $this->assets((array) $this->block ?? []); + $instance = (array) ($this->block ?? []); + + add_action('enqueue_block_assets', function () use ($instance): void { + $this->assets($instance); }); }