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

git-svn-id: http://svn.automattic.com/wordpress/trunk@18816 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2011-09-29 19:37:58 +00:00
parent 008beac918
commit 1066f1addb
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) ) {