670 | | if ( $wpdb->query($wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_key = %s", $post_meta_key)) ) { |
671 | | /** @todo Get post_ids and delete cache */ |
672 | | // wp_cache_delete($post_id, 'post_meta'); |
| 670 | $post_ids = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT post_id FROM $wpdb->postmeta WHERE meta_key LIKE %s", $post_meta_key)); |
| 671 | if ( $post_ids ) { |
| 672 | $wpdb->query($wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_key LIKE %s", $post_meta_key)); |
| 673 | foreach ( $post_ids as $post_id ) |
| 674 | wp_cache_delete($post_id, 'post_meta'); |