Make WordPress Core


Ignore:
Timestamp:
08/03/2011 04:48:37 PM (13 years ago)
Author:
ryan
Message:

Turn delete_meta() , get_post_meta_by_id(), update_meta(), delete_post_meta_by_key() into wrappers around the metadata API. Add back compat *_postmeta actions to metadata API. Props jgadbois. see #18196

File:
1 edited

Legend:

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

    r18472 r18500  
    14981498 */
    14991499function delete_post_meta_by_key($post_meta_key) {
    1500     if ( !$post_meta_key )
    1501         return false;
    1502 
    1503     global $wpdb;
    1504     $post_ids = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT post_id FROM $wpdb->postmeta WHERE meta_key = %s", $post_meta_key));
    1505     if ( $post_ids ) {
    1506         $postmetaids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE meta_key = %s", $post_meta_key ) );
    1507         $in = implode( ',', array_fill(1, count($postmetaids), '%d'));
    1508         do_action( 'delete_postmeta', $postmetaids );
    1509         $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_id IN($in)", $postmetaids ));
    1510         do_action( 'deleted_postmeta', $postmetaids );
    1511         foreach ( $post_ids as $post_id )
    1512             wp_cache_delete($post_id, 'post_meta');
    1513         return true;
    1514     }
    1515     return false;
     1500    return delete_metadata( 'post', null, $post_meta_key, '', true );
    15161501}
    15171502
Note: See TracChangeset for help on using the changeset viewer.