WordPress.org

Make WordPress Core

Changeset 11999


Ignore:
Timestamp:
10/06/2009 07:18:21 PM (9 years ago)
Author:
westi
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/meta.php

    r11996 r11999  
    8282
    8383function delete_metadata($meta_type, $object_id, $meta_key, $meta_value = '', $delete_all = false) {
    84     if ( !$meta_type || !$meta_key || (!$delete_all && ! (int)$object_id) )
    85         return false;
    86 
    87     if ( ! $table = _get_meta_table($meta_type) )
    88         return false;
    89 
    90     global $wpdb;
    91 
     84    if ( !$meta_type || !$meta_key || (!$delete_all && ! (int)$object_id) )
     85        return false;
     86   
     87    if ( ! $table = _get_meta_table($meta_type) )
     88        return false;
     89
     90    global $wpdb;
     91
     92    $type_column = esc_sql($meta_type . '_id');
    9293    // expected_slashed ($meta_key)
    9394    $meta_key = stripslashes($meta_key);
     
    9798
    9899    if ( !$delete_all )
    99         $query .= $wpdb->prepare(" AND %s = %d", $meta_type . '_id', $object_id );
     100        $query .= $wpdb->prepare(" AND $type_column = %d", $object_id );
    100101
    101102    if ( $meta_value )
Note: See TracChangeset for help on using the changeset viewer.