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 ) { foreach ( $meta_keys as $id => $meta_key ) {
$meta_value = ( empty( $meta_values[ $id ] ) && ! is_numeric( $meta_values[ $id ] ) ) ? '' : $meta_values[ $id ]; $meta_value = ( empty( $meta_values[ $id ] ) && ! is_numeric( $meta_values[ $id ] ) ) ? '' : $meta_values[ $id ];
$meta_value = stripslashes( $meta_value );
$wpdb->update( $wpdb->update(
$wpdb->prefix . "woocommerce_order_itemmeta", $wpdb->prefix . "woocommerce_order_itemmeta",
array( array(
'meta_key' => $meta_key, 'meta_key' => wp_unslash($meta_key),
'meta_value' => $meta_value 'meta_value' => wp_unslash($meta_value)
), ),
array( 'meta_id' => $id ), array( 'meta_id' => $id ),
array( '%s', '%s' ), array( '%s', '%s' ),