Prevent extra slashes on meta values

by_mid functions do not expect slashes

Fixes #15868
This commit is contained in:
Mike Jolley 2017-06-29 22:41:11 +01:00
parent b999864fa1
commit 3bfd2bab48
2 changed files with 4 additions and 4 deletions

View File

@ -111,7 +111,7 @@ class WC_Data_Store_WP {
* @param stdClass (containing ->id, ->key and ->value) * @param stdClass (containing ->id, ->key and ->value)
*/ */
public function update_meta( &$object, $meta ) { public function update_meta( &$object, $meta ) {
update_metadata_by_mid( $this->meta_type, $meta->id, wp_slash( $meta->value ), $meta->key ); update_metadata_by_mid( $this->meta_type, $meta->id, $meta->value, $meta->key );
} }
/** /**

View File

@ -75,7 +75,7 @@ class WC_Order_Item_Data_Store implements WC_Order_Item_Data_Store_Interface {
* @return bool * @return bool
*/ */
public function update_metadata( $item_id, $meta_key, $meta_value, $prev_value = '' ) { public function update_metadata( $item_id, $meta_key, $meta_value, $prev_value = '' ) {
return update_metadata( 'order_item', $item_id, $meta_key, $meta_value, $prev_value ); return update_metadata( 'order_item', $item_id, $meta_key, wp_slash( $meta_value ), $prev_value );
} }
/** /**
@ -89,7 +89,7 @@ class WC_Order_Item_Data_Store implements WC_Order_Item_Data_Store_Interface {
* @return int New row ID or 0 * @return int New row ID or 0
*/ */
public function add_metadata( $item_id, $meta_key, $meta_value, $unique = false ) { public function add_metadata( $item_id, $meta_key, $meta_value, $unique = false ) {
return add_metadata( 'order_item', $item_id, $meta_key, $meta_value, $unique ); return add_metadata( 'order_item', $item_id, $meta_key, wp_slash( $meta_value ), $unique );
} }
/** /**
@ -103,7 +103,7 @@ class WC_Order_Item_Data_Store implements WC_Order_Item_Data_Store_Interface {
* @return bool * @return bool
*/ */
public function delete_metadata( $item_id, $meta_key, $meta_value = '', $delete_all = false ) { public function delete_metadata( $item_id, $meta_key, $meta_value = '', $delete_all = false ) {
return delete_metadata( 'order_item', $item_id, $meta_key, $meta_value, $delete_all ); return delete_metadata( 'order_item', $item_id, $meta_key, wp_slash( $meta_value ), $delete_all );
} }
/** /**