Ticket #14766: wp-includes-meta-filters.patch
File wp-includes-meta-filters.patch, 1.9 KB (added by , 14 years ago) |
---|
-
meta.php
45 45 // expected_slashed ($meta_key) 46 46 $meta_key = stripslashes($meta_key); 47 47 48 $check = apply_filters( "add_{$meta_type}_metadata" , null, $object_id, $meta_key, $meta_value, $unique ); 49 if ( null !== $check ) 50 return true; 51 48 52 if ( $unique && $wpdb->get_var( $wpdb->prepare( 49 53 "SELECT COUNT(*) FROM $table WHERE meta_key = %s AND $column = %d", 50 54 $meta_key, $object_id ) ) ) … … 106 110 // expected_slashed ($meta_key) 107 111 $meta_key = stripslashes($meta_key); 108 112 113 $check = apply_filters( "update_{$meta_type}_metadata" , null, $object_id, $meta_key, $meta_value, $prev_value ); 114 if ( null !== $check ) 115 return true; 116 109 117 if ( ! $meta_id = $wpdb->get_var( $wpdb->prepare( "SELECT $id_column FROM $table WHERE meta_key = %s AND $column = %d", $meta_key, $object_id ) ) ) 110 118 return add_metadata($meta_type, $object_id, $meta_key, $meta_value); 111 119 … … 178 186 $meta_key = stripslashes($meta_key); 179 187 $meta_value = maybe_serialize( stripslashes_deep($meta_value) ); 180 188 189 $check = apply_filters( "delete_{$meta_type}_metadata" , null, $object_id, $meta_key, $meta_value, $delete_all ); 190 if ( null !== $check ) 191 return true; 192 181 193 $query = $wpdb->prepare( "SELECT $id_column FROM $table WHERE meta_key = %s", $meta_key ); 182 194 183 195 if ( !$delete_all ) … … 227 239 if ( !$object_id = absint($object_id) ) 228 240 return false; 229 241 242 $check = apply_filters( "get_{$meta_type}_metadata" , null, $object_id, $meta_key, $single ); 243 if ( null !== $check ) { 244 if ( !is_array( $check ) ) 245 return $check; 246 elseif ( $single ) 247 return maybe_unserialize( $check[0] ); 248 else 249 return array_map('maybe_unserialize', $check); 250 } 251 230 252 $meta_cache = wp_cache_get($object_id, $meta_type . '_meta'); 231 253 232 254 if ( !$meta_cache ) {