Make WordPress Core


Ignore:
Timestamp:
04/11/2012 08:02:39 PM (13 years ago)
Author:
nacin
Message:

Use the metadata API rather than raw queries and direct do_action calls. see #20417.

File:
1 edited

Legend:

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

    r20423 r20435  
    981981
    982982    // Delete metadata
    983     $meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->commentmeta WHERE comment_id = %d ", $comment_id ) );
    984     if ( !empty($meta_ids) ) {
    985         do_action( 'delete_commentmeta', $meta_ids );
    986         $in_meta_ids = "'" . implode("', '", $meta_ids) . "'";
    987         $wpdb->query( "DELETE FROM $wpdb->commentmeta WHERE meta_id IN ($in_meta_ids)" );
    988         do_action( 'deleted_commentmeta', $meta_ids );
    989     }
     983    $meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->commentmeta WHERE comment_id = %d", $comment_id ) );
     984    foreach ( $meta_ids as $mid )
     985        delete_metadata_by_mid( 'comment', $mid );
    990986
    991987    if ( ! $wpdb->delete( $wpdb->comments, array( 'comment_ID' => $comment_id ) ) )
Note: See TracChangeset for help on using the changeset viewer.