Don't double-unslash meta key when `update_metadata()` falls back on `add_metadata()`.
Props jdgrimes. Fixes #35795. Built from https://develop.svn.wordpress.org/trunk@36509 git-svn-id: http://core.svn.wordpress.org/trunk@36476 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
dae31f7d95
commit
1370d8b869
|
@ -161,6 +161,7 @@ function update_metadata($meta_type, $object_id, $meta_key, $meta_value, $prev_v
|
|||
$id_column = 'user' == $meta_type ? 'umeta_id' : 'meta_id';
|
||||
|
||||
// expected_slashed ($meta_key)
|
||||
$raw_meta_key = $meta_key;
|
||||
$meta_key = wp_unslash($meta_key);
|
||||
$passed_value = $meta_value;
|
||||
$meta_value = wp_unslash($meta_value);
|
||||
|
@ -198,7 +199,7 @@ function update_metadata($meta_type, $object_id, $meta_key, $meta_value, $prev_v
|
|||
|
||||
$meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT $id_column FROM $table WHERE meta_key = %s AND $column = %d", $meta_key, $object_id ) );
|
||||
if ( empty( $meta_ids ) ) {
|
||||
return add_metadata($meta_type, $object_id, $meta_key, $passed_value);
|
||||
return add_metadata( $meta_type, $object_id, $raw_meta_key, $passed_value );
|
||||
}
|
||||
|
||||
$_meta_value = $meta_value;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.5-alpha-36508';
|
||||
$wp_version = '4.5-alpha-36509';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue