diff --git a/wp-includes/meta.php b/wp-includes/meta.php index b57e761f46..bcfc847e80 100644 --- a/wp-includes/meta.php +++ b/wp-includes/meta.php @@ -294,14 +294,17 @@ function update_metadata($meta_type, $object_id, $meta_key, $meta_value, $prev_v * * @global wpdb $wpdb WordPress database abstraction object. * - * @param string $meta_type Type of object metadata is for (e.g., comment, post, or user) - * @param int $object_id ID of the object metadata is for - * @param string $meta_key Metadata key - * @param mixed $meta_value Optional. Metadata value. Must be serializable if non-scalar. If specified, only delete metadata entries - * with this value. Otherwise, delete all entries with the specified meta_key. - * @param bool $delete_all Optional, default is false. If true, delete matching metadata entries - * for all objects, ignoring the specified object_id. Otherwise, only delete matching - * metadata entries for the specified object_id. + * @param string $meta_type Type of object metadata is for (e.g., comment, post, or user) + * @param int $object_id ID of the object metadata is for + * @param string $meta_key Metadata key + * @param mixed $meta_value Optional. Metadata value. Must be serializable if non-scalar. If specified, only delete + * metadata entries with this value. Otherwise, delete all entries with the specified meta_key. + * Pass `null, `false`, or an empty string to skip this check. (For backward compatibility, + * it is not possible to pass an empty string to delete those entries with an empty string + * for a value.) + * @param bool $delete_all Optional, default is false. If true, delete matching metadata entries for all objects, + * ignoring the specified object_id. Otherwise, only delete matching metadata entries for + * the specified object_id. * @return bool True on successful delete, false on failure. */ function delete_metadata($meta_type, $object_id, $meta_key, $meta_value = '', $delete_all = false) { @@ -356,7 +359,7 @@ function delete_metadata($meta_type, $object_id, $meta_key, $meta_value = '', $d if ( !$delete_all ) $query .= $wpdb->prepare(" AND $type_column = %d", $object_id ); - if ( $meta_value ) + if ( '' !== $meta_value && null !== $meta_value && false !== $meta_value ) $query .= $wpdb->prepare(" AND meta_value = %s", $meta_value ); $meta_ids = $wpdb->get_col( $query ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 2cbebc9a82..54b9775bbe 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.3-alpha-32330'; +$wp_version = '4.3-alpha-32331'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.