From 98d9dbdcf04e278d43d94ff2de038ec23f809839 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albert=20Juh=C3=A9=20Lluveras?= Date: Mon, 29 Nov 2021 10:45:53 +0100 Subject: [PATCH] Don't run enqueue_assets on REST requests (https://github.com/woocommerce/woocommerce-blocks/pull/5260) --- plugins/woocommerce-blocks/src/BlockTypes/AbstractBlock.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/woocommerce-blocks/src/BlockTypes/AbstractBlock.php b/plugins/woocommerce-blocks/src/BlockTypes/AbstractBlock.php index a5d9f4006bf..79c295aa849 100644 --- a/plugins/woocommerce-blocks/src/BlockTypes/AbstractBlock.php +++ b/plugins/woocommerce-blocks/src/BlockTypes/AbstractBlock.php @@ -81,7 +81,7 @@ abstract class AbstractBlock { */ public function render_callback( $attributes = [], $content = '' ) { $render_callback_attributes = $this->parse_render_callback_attributes( $attributes ); - if ( ! is_admin() ) { + if ( ! is_admin() && ! WC()->is_rest_api_request() ) { $this->enqueue_assets( $render_callback_attributes ); } return $this->render( $render_callback_attributes, $content );