Make WordPress Core

Changeset 5976


Ignore:
Timestamp:
08/29/2007 07:12:20 PM (17 years ago)
Author:
ryan
Message:

delete_post_meta_by_key() from Mark Jaquith. fixes #4178

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/post.php

    r5918 r5976  
    383383
    384384    return true;
     385}
     386
     387
     388function delete_post_meta_by_key($post_meta_key) {
     389    global $wpdb, $post_meta_cache, $blog_id;
     390    $post_meta_key = $wpdb->escape($post_meta_key);
     391    if ( $wpdb->query("DELETE FROM $wpdb->postmeta WHERE meta_key = '$post_meta_key'") ) {
     392        unset($post_meta_cache[$blog_id]); // not worth doing the work to iterate through the cache
     393        return true;
     394    }
     395    return false;
    385396}
    386397
Note: See TracChangeset for help on using the changeset viewer.