Changeset 11968 for trunk/wp-includes/meta.php
- Timestamp:
- 09/24/2009 05:10:28 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/meta.php
r11948 r11968 58 58 $meta_key = stripslashes($meta_key); 59 59 60 if ( ! $ wpdb->get_var( $wpdb->prepare( "SELECT meta_keyFROM $table WHERE meta_key = %s AND $column = %d", $meta_key, $object_id ) ) )60 if ( ! $meta_id = $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $table WHERE meta_key = %s AND $column = %d", $meta_key, $object_id ) ) ) 61 61 return add_metadata($meta_type, $object_id, $meta_key, $meta_value); 62 62 … … 71 71 } 72 72 73 do_action( "update_{$meta_type}_meta", $object_id, $meta_key, $meta_value );73 do_action( "update_{$meta_type}_meta", $object_id, $meta_key, $meta_value, $meta_id ); 74 74 75 75 $wpdb->update( $table, $data, $where ); 76 76 wp_cache_delete($object_id, $meta_type . '_meta'); 77 77 78 do_action( "updated_{$meta_type}_meta", $object_id, $meta_key, $meta_value );78 do_action( "updated_{$meta_type}_meta", $object_id, $meta_key, $meta_value, $meta_id ); 79 79 80 80 return true; … … 96 96 $meta_value = maybe_serialize( stripslashes_deep($meta_value) ); 97 97 98 $query = $wpdb->prepare( " DELETEFROM $table WHERE meta_key = %s", $meta_key );99 98 $query = $wpdb->prepare( "SELECT meta_id FROM $table WHERE meta_key = %s", $meta_key ); 99 100 100 if ( $meta_value ) 101 101 $query .= $wpdb->prepare("AND meta_value = %s", $meta_value ); 102 103 $meta_ids = $wpdb->get_col( $query ); 104 if ( !count( $meta_ids ) ) 105 return false; 106 107 $query = "DELETE FROM $table WHERE meta_id IN( " . implode( ',', $meta_ids ) . " )"; 102 108 103 109 $count = $wpdb->query($query); … … 108 114 wp_cache_delete($object_id, $meta_type . '_meta'); 109 115 110 do_action( "deleted_{$meta_type}_meta", $object_id, $meta_key, $meta_value );116 do_action( "deleted_{$meta_type}_meta", $object_id, $meta_key, $meta_value, $meta_ids ); 111 117 112 118 return true;
Note: See TracChangeset
for help on using the changeset viewer.