unslash order item meta key before updating in DB

To prevent nested slashes in DB when item meta key contains quotes.
This is in line with WordPress' behaviour - see update_meta() in wp-includes/meta.php
This commit is contained in:
enru 2014-06-04 15:09:01 +01:00
parent 09c4e1c07a
commit 23950bcf0d
1 changed files with 3 additions and 4 deletions

View File

@ -164,12 +164,11 @@ class WC_Meta_Box_Order_Items {
foreach ( $meta_keys as $id => $meta_key ) {
$meta_value = ( empty( $meta_values[ $id ] ) && ! is_numeric( $meta_values[ $id ] ) ) ? '' : $meta_values[ $id ];
$meta_value = stripslashes( $meta_value );
$wpdb->update(
$wpdb->prefix . "woocommerce_order_itemmeta",
array(
'meta_key' => $meta_key,
'meta_value' => $meta_value
'meta_key' => wp_unslash($meta_key),
'meta_value' => wp_unslash($meta_value)
),
array( 'meta_id' => $id ),
array( '%s', '%s' ),
@ -180,4 +179,4 @@ class WC_Meta_Box_Order_Items {
// Update cart discount from item totals
update_post_meta( $post_id, '_cart_discount', $subtotal - $total );
}
}
}