From 56240c9633090a106c0407c54a306049fb4bf6e1 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Tue, 9 Jul 2019 15:23:46 -0300 Subject: [PATCH] Prevent saving empty tax classes into the database --- includes/admin/settings/class-wc-settings-tax.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/admin/settings/class-wc-settings-tax.php b/includes/admin/settings/class-wc-settings-tax.php index 30e7bad3f71..b8f3563b0bd 100644 --- a/includes/admin/settings/class-wc-settings-tax.php +++ b/includes/admin/settings/class-wc-settings-tax.php @@ -140,7 +140,7 @@ class WC_Settings_Tax extends WC_Settings_Page { * @return null */ public function save_tax_classes( $raw_tax_classes ) { - $tax_classes = array_map( 'trim', explode( "\n", $raw_tax_classes ) ); + $tax_classes = array_filter( array_map( 'trim', explode( "\n", $raw_tax_classes ) ) ); $existing_tax_classes = WC_Tax::get_tax_classes(); $removed = array_diff( $existing_tax_classes, $tax_classes ); $added = array_diff( $tax_classes, $existing_tax_classes );