From 285151843fe27a4876b0f08375df9484d0ea2bf1 Mon Sep 17 00:00:00 2001 From: "Md. Saiful Islam" Date: Tue, 30 Oct 2018 11:36:16 +0600 Subject: [PATCH] compare with $request['id'] instead of $term --- includes/abstracts/abstract-wc-rest-terms-controller.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/abstracts/abstract-wc-rest-terms-controller.php b/includes/abstracts/abstract-wc-rest-terms-controller.php index b119ec4ded9..c782a7beb4f 100644 --- a/includes/abstracts/abstract-wc-rest-terms-controller.php +++ b/includes/abstracts/abstract-wc-rest-terms-controller.php @@ -537,8 +537,8 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller { $default_category_id = absint( get_option( 'default_product_cat', 0 ) ); // Prevent deleting the default product category. - if ( $default_category_id === $term ) { - return new WP_Error( 'woocommerce_rest_default_product_cat_cannot_delete', __( 'Default product category cannot be deleted.', 'woocommerce' ), array( 'status' => 500 ) ); + if ( $default_category_id === (int) $request['id'] ) { + return new WP_Error( 'woocommerce_rest_cannot_delete', __( 'Default product category cannot be deleted.', 'woocommerce' ), array( 'status' => 500 ) ); } $request->set_param( 'context', 'edit' );