Don't update meta data when the new value matches the old value. fixes #13350
git-svn-id: http://svn.automattic.com/wordpress/trunk@14564 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
98b2e56753
commit
b2150816f8
|
@ -109,6 +109,15 @@ function update_metadata($meta_type, $object_id, $meta_key, $meta_value, $prev_v
|
|||
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);
|
||||
|
||||
// Compare existing value to new value if no prev value given and the key exists only once.
|
||||
if ( empty($prev_value) ) {
|
||||
$old_value = get_metadata($meta_type, $object_id, $meta_key);
|
||||
if ( count($old_value) == 1 ) {
|
||||
if ( $old_value[0] == $meta_value )
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$_meta_value = $meta_value;
|
||||
$meta_value = maybe_serialize( stripslashes_deep($meta_value) );
|
||||
|
||||
|
|
Loading…
Reference in New Issue