Pass unslashed values from update_metadata() to add_metadata(). fixes #17343.

git-svn-id: https://develop.svn.wordpress.org/trunk@18816 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2011-09-29 19:37:58 +00:00
parent d9b37f77c8
commit 32ba775ad7
1 changed files with 2 additions and 1 deletions

View File

@ -115,6 +115,7 @@ function update_metadata($meta_type, $object_id, $meta_key, $meta_value, $prev_v
// expected_slashed ($meta_key)
$meta_key = stripslashes($meta_key);
$passed_value = $meta_value;
$meta_value = stripslashes_deep($meta_value);
$meta_value = sanitize_meta( $meta_key, $meta_value, $meta_type );
@ -123,7 +124,7 @@ function update_metadata($meta_type, $object_id, $meta_key, $meta_value, $prev_v
return (bool) $check;
if ( ! $meta_id = $wpdb->get_var( $wpdb->prepare( "SELECT $id_column FROM $table WHERE meta_key = %s AND $column = %d", $meta_key, $object_id ) ) )
return add_metadata($meta_type, $object_id, $meta_key, $meta_value);
return add_metadata($meta_type, $object_id, $meta_key, $passed_value);
// Compare existing value to new value if no prev value given and the key exists only once.
if ( empty($prev_value) ) {