WordPress.org

Make WordPress Core

Changeset 12156


Ignore:
Timestamp:
11/08/2009 11:05:49 AM (9 years ago)
Author:
westi
Message:

Fix delete_post_meta_by_key() so that you can delete postmeta items by key again. Fixes #11100.

File:
1 edited

Legend:

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

    r12148 r12156  
    694694    if ( $post_ids ) {
    695695        $postmetaids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE meta_key = %s", $post_meta_key ) );
     696        $in = implode( ',', array_fill(1, count($postmetaids), '%d'));
    696697        do_action( 'delete_postmeta', $postmetaids );
    697         $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_id IN(%s)", implode( ',', $postmetaids) ) );
     698        $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_id IN($in)", $postmetaids ));
    698699        do_action( 'deleted_postmeta', $postmetaids );
    699700        foreach ( $post_ids as $post_id )
Note: See TracChangeset for help on using the changeset viewer.