Only run "woocommerce_admin_shared_settings" filter on admin requests (#51161)
* Only load settings if it's admin * Add changelog
This commit is contained in:
parent
0ef7d95aff
commit
cb2549386a
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: performance
|
||||||
|
|
||||||
|
Only run woocommerce_admin_shared_settings filter on admin requests
|
|
@ -54,14 +54,18 @@ class WCAdminSharedSettings {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function on_woocommerce_blocks_loaded() {
|
public function on_woocommerce_blocks_loaded() {
|
||||||
|
// Ensure we only add admin settings on the admin.
|
||||||
|
if ( ! is_admin() ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ( class_exists( '\Automattic\WooCommerce\Blocks\Assets\AssetDataRegistry' ) ) {
|
if ( class_exists( '\Automattic\WooCommerce\Blocks\Assets\AssetDataRegistry' ) ) {
|
||||||
\Automattic\WooCommerce\Blocks\Package::container()->get( \Automattic\WooCommerce\Blocks\Assets\AssetDataRegistry::class )->add(
|
\Automattic\WooCommerce\Blocks\Package::container()->get( \Automattic\WooCommerce\Blocks\Assets\AssetDataRegistry::class )->add(
|
||||||
$this->settings_prefix,
|
$this->settings_prefix,
|
||||||
function() {
|
function () {
|
||||||
return apply_filters( 'woocommerce_admin_shared_settings', array() );
|
return apply_filters( 'woocommerce_admin_shared_settings', array() );
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue