Clear cache after deleting meta. Props Denis-de-Bernardy. fixes #9009

git-svn-id: http://svn.automattic.com/wordpress/trunk@11305 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2009-05-12 17:10:05 +00:00
parent 5924293d21
commit f25182f1e5
1 changed files with 5 additions and 3 deletions

View File

@ -684,9 +684,11 @@ function delete_post_meta_by_key($post_meta_key) {
return false; return false;
global $wpdb; global $wpdb;
if ( $wpdb->query($wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_key = %s", $post_meta_key)) ) { $post_ids = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT post_id FROM $wpdb->postmeta WHERE meta_key = %s", $post_meta_key));
/** @todo Get post_ids and delete cache */ if ( $post_ids ) {
// wp_cache_delete($post_id, 'post_meta'); $wpdb->query($wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_key = %s", $post_meta_key));
foreach ( $post_ids as $post_id )
wp_cache_delete($post_id, 'post_meta');
return true; return true;
} }
return false; return false;