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:
parent
40a9656f7b
commit
cdfcd94358
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: performance
|
||||||
|
|
||||||
|
Limit loading product block editor to admin pages and rest requests
|
|
@ -3,6 +3,8 @@
|
||||||
* WooCommerce Product Block Editor
|
* WooCommerce Product Block Editor
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types = 1);
|
||||||
|
|
||||||
namespace Automattic\WooCommerce\Admin\Features\ProductBlockEditor;
|
namespace Automattic\WooCommerce\Admin\Features\ProductBlockEditor;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Admin\Features\Features;
|
use Automattic\WooCommerce\Admin\Features\Features;
|
||||||
|
@ -49,6 +51,10 @@ class Init {
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
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, 'variable' );
|
||||||
array_push( $this->supported_product_types, 'external' );
|
array_push( $this->supported_product_types, 'external' );
|
||||||
array_push( $this->supported_product_types, 'grouped' );
|
array_push( $this->supported_product_types, 'grouped' );
|
||||||
|
|
Loading…
Reference in New Issue