Fix the specification of the object_type column in delete_metadata so that it will delete stuff if $delete_all is false. See #2659

git-svn-id: https://develop.svn.wordpress.org/trunk@11999 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Peter Westwood 2009-10-06 19:18:21 +00:00
parent de6f496e44
commit 9698b2716d

View File

@ -89,6 +89,7 @@ function delete_metadata($meta_type, $object_id, $meta_key, $meta_value = '', $d
global $wpdb;
$type_column = esc_sql($meta_type . '_id');
// expected_slashed ($meta_key)
$meta_key = stripslashes($meta_key);
$meta_value = maybe_serialize( stripslashes_deep($meta_value) );
@ -96,7 +97,7 @@ function delete_metadata($meta_type, $object_id, $meta_key, $meta_value = '', $d
$query = $wpdb->prepare( "SELECT meta_id FROM $table WHERE meta_key = %s", $meta_key );
if ( !$delete_all )
$query .= $wpdb->prepare(" AND %s = %d", $meta_type . '_id', $object_id );
$query .= $wpdb->prepare(" AND $type_column = %d", $object_id );
if ( $meta_value )
$query .= $wpdb->prepare(" AND meta_value = %s", $meta_value );