Only add the network order widget/register the route when multisite is active
This commit is contained in:
parent
59152d40be
commit
54c7165e16
|
@ -39,7 +39,9 @@ class WC_Admin_Dashboard {
|
||||||
wp_add_dashboard_widget( 'woocommerce_dashboard_status', __( 'WooCommerce status', 'woocommerce' ), array( $this, 'status_widget' ) );
|
wp_add_dashboard_widget( 'woocommerce_dashboard_status', __( 'WooCommerce status', 'woocommerce' ), array( $this, 'status_widget' ) );
|
||||||
|
|
||||||
// Network Order Widget
|
// Network Order Widget
|
||||||
wp_add_dashboard_widget( 'woocommerce_network_orders', __( "WooCommerce Network Orders", 'woocommerce' ), array( $this, 'network_orders' ) );
|
if ( is_multisite() ) {
|
||||||
|
wp_add_dashboard_widget( 'woocommerce_network_orders', __( "WooCommerce Network Orders", 'woocommerce' ), array( $this, 'network_orders' ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -122,15 +122,17 @@ class WC_REST_Orders_Controller extends WC_REST_Legacy_Orders_Controller {
|
||||||
'schema' => array( $this, 'get_public_batch_schema' ),
|
'schema' => array( $this, 'get_public_batch_schema' ),
|
||||||
) );
|
) );
|
||||||
|
|
||||||
register_rest_route( $this->namespace, '/' . $this->rest_base . '/network', array(
|
if ( is_multisite() ) {
|
||||||
array(
|
register_rest_route( $this->namespace, '/' . $this->rest_base . '/network', array(
|
||||||
'methods' => WP_REST_Server::READABLE,
|
array(
|
||||||
'callback' => array( $this, 'network_orders' ),
|
'methods' => WP_REST_Server::READABLE,
|
||||||
'permission_callback' => array( $this, 'network_orders_permissions_check' ),
|
'callback' => array( $this, 'network_orders' ),
|
||||||
'args' => $this->get_collection_params(),
|
'permission_callback' => array( $this, 'network_orders_permissions_check' ),
|
||||||
),
|
'args' => $this->get_collection_params(),
|
||||||
'schema' => array( $this, 'get_public_item_schema' ),
|
),
|
||||||
) );
|
'schema' => array( $this, 'get_public_item_schema' ),
|
||||||
|
) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue