delete_post_meta_by_key() from Mark Jaquith. fixes #4178

git-svn-id: http://svn.automattic.com/wordpress/trunk@5976 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2007-08-29 19:12:20 +00:00
parent 0f6dfb8b1f
commit d330ec7e34
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;