mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-22 15:31:42 +01:00
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:
parent
0f6dfb8b1f
commit
d330ec7e34
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user