Ticket #14766: wp-includes-meta-filters-refresh.patch
| File wp-includes-meta-filters-refresh.patch, 1.9 KB (added by , 15 years ago) |
|---|
-
wp-includes/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 (bool) $check; 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 ) ) ) … … 108 112 // expected_slashed ($meta_key) 109 113 $meta_key = stripslashes($meta_key); 110 114 115 $check = apply_filters( "update_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $prev_value ); 116 if ( null !== $check ) 117 return (bool) $check; 118 111 119 if ( ! $meta_id = $wpdb->get_var( $wpdb->prepare( "SELECT $id_column FROM $table WHERE meta_key = %s AND $column = %d", $meta_key, $object_id ) ) ) 112 120 return add_metadata($meta_type, $object_id, $meta_key, $meta_value); 113 121 … … 180 188 $meta_key = stripslashes($meta_key); 181 189 $meta_value = maybe_serialize( stripslashes_deep($meta_value) ); 182 190 191 $check = apply_filters( "delete_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $delete_all ); 192 if ( null !== $check ) 193 return (bool) $check; 194 183 195 $query = $wpdb->prepare( "SELECT $id_column FROM $table WHERE meta_key = %s", $meta_key ); 184 196 185 197 if ( !$delete_all ) … … 231 243 if ( !$object_id = absint($object_id) ) 232 244 return false; 233 245 246 $check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, $single ); 247 if ( null !== $check ) { 248 if ( !is_array( $check ) ) 249 return $check; 250 elseif ( $single ) 251 return maybe_unserialize( $check[0] ); 252 else 253 return array_map( 'maybe_unserialize', $check ); 254 } 255 234 256 $meta_cache = wp_cache_get($object_id, $meta_type . '_meta'); 235 257 236 258 if ( !$meta_cache ) {