Limit loading product block editor to admin pages and rest requests (#51954)

* Limit loading product block editor to admin pages and rest requests

* Add changelog entry
This commit is contained in:
Joshua T Flowers 2024-10-16 06:57:06 -04:00 committed by GitHub
parent 40a9656f7b
commit cdfcd94358
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 0 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: performance
Limit loading product block editor to admin pages and rest requests

View File

@ -3,6 +3,8 @@
* WooCommerce Product Block Editor
*/
declare(strict_types = 1);
namespace Automattic\WooCommerce\Admin\Features\ProductBlockEditor;
use Automattic\WooCommerce\Admin\Features\Features;
@ -49,6 +51,10 @@ class Init {
* Constructor
*/
public function __construct() {
if ( ! is_admin() && ! WC()->is_rest_api_request() ) {
return;
}
array_push( $this->supported_product_types, 'variable' );
array_push( $this->supported_product_types, 'external' );
array_push( $this->supported_product_types, 'grouped' );