Use consistent sanitization on tax classes (#41220)
This commit is contained in:
commit
8134a9237c
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
|
||||
Use consistent sanitization when saving tax classes.
|
|
@ -408,6 +408,14 @@ class WC_Admin_Post_Types {
|
|||
}
|
||||
}
|
||||
|
||||
if ( ! empty( $request_data['_tax_class'] ) ) {
|
||||
$tax_class = sanitize_title( wp_unslash( $request_data['_tax_class'] ) );
|
||||
if ( 'standard' === $tax_class ) {
|
||||
$tax_class = '';
|
||||
}
|
||||
$product->set_tax_class( $tax_class );
|
||||
}
|
||||
|
||||
$product->set_featured( isset( $request_data['_featured'] ) );
|
||||
|
||||
if ( $product->is_type( 'simple' ) || $product->is_type( 'external' ) ) {
|
||||
|
@ -505,7 +513,7 @@ class WC_Admin_Post_Types {
|
|||
}
|
||||
|
||||
if ( ! empty( $request_data['_tax_class'] ) ) {
|
||||
$tax_class = wc_clean( wp_unslash( $request_data['_tax_class'] ) );
|
||||
$tax_class = sanitize_title( wp_unslash( $request_data['_tax_class'] ) );
|
||||
if ( 'standard' === $tax_class ) {
|
||||
$tax_class = '';
|
||||
}
|
||||
|
|
|
@ -546,7 +546,7 @@ class WC_Meta_Box_Product_Data {
|
|||
'width' => isset( $_POST['variable_width'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_width'][ $i ] ) ) : '',
|
||||
'height' => isset( $_POST['variable_height'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_height'][ $i ] ) ) : '',
|
||||
'shipping_class_id' => isset( $_POST['variable_shipping_class'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_shipping_class'][ $i ] ) ) : null,
|
||||
'tax_class' => isset( $_POST['variable_tax_class'][ $i ] ) ? wc_clean( wp_unslash( $_POST['variable_tax_class'][ $i ] ) ) : null,
|
||||
'tax_class' => isset( $_POST['variable_tax_class'][ $i ] ) ? sanitize_title( wp_unslash( $_POST['variable_tax_class'][ $i ] ) ) : null,
|
||||
)
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in New Issue