delete_post_meta_by_key() from Mark Jaquith. fixes #4178

git-svn-id: https://develop.svn.wordpress.org/trunk@5976 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2007-08-29 19:12:20 +00:00
parent d8381c8973
commit 7109e26194
1 changed files with 11 additions and 0 deletions

View File

@ -385,6 +385,17 @@ function update_post_meta($post_id, $key, $value, $prev_value = '') {
}
function delete_post_meta_by_key($post_meta_key) {
global $wpdb, $post_meta_cache, $blog_id;
$post_meta_key = $wpdb->escape($post_meta_key);
if ( $wpdb->query("DELETE FROM $wpdb->postmeta WHERE meta_key = '$post_meta_key'") ) {
unset($post_meta_cache[$blog_id]); // not worth doing the work to iterate through the cache
return true;
}
return false;
}
function get_post_custom($post_id = 0) {
global $id, $post_meta_cache, $wpdb, $blog_id;