Index: /Users/denis/Sites/sem-pro/wp-includes/post.php
===================================================================
--- /Users/denis/Sites/sem-pro/wp-includes/post.php	(revision 829)
+++ /Users/denis/Sites/sem-pro/wp-includes/post.php	(working copy)
@@ -663,13 +663,27 @@
  * @uses $wpdb
  *
  * @param string $post_meta_key Key to search for when deleting.
+ * @param string $operator The SQL operator. Can be any of LIKE, NOT LIKE, REGEXP, NOT REGEXP
  * @return bool Whether the post meta key was deleted from the database
  */
-function delete_post_meta_by_key($post_meta_key) {
+function delete_post_meta_by_key($post_meta_key, $operator = false) {
 	global $wpdb;
-	if ( $wpdb->query($wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_key = %s", $post_meta_key)) ) {
-		/** @todo Get post_ids and delete cache */
-		// wp_cache_delete($post_id, 'post_meta');
+	
+	switch ( $operator ) {
+	case 'LIKE':
+	case 'NOT LIKE':
+	case 'REGEXP':
+	case 'NOT REGEXP':
+		break;
+	default:
+		$operator = 'LIKE';
+	}
+	
+	$post_ids = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT post_id FROM $wpdb->postmeta WHERE meta_key LIKE %s", $post_meta_key));
+	if ( $post_ids ) {
+		$wpdb->query($wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_key LIKE %s", $post_meta_key));
+		foreach ( $post_ids as $post_id )
+			wp_cache_delete($post_id, 'post_meta');
 		return true;
 	}
 	return false;
