WordPress.org

Make WordPress Core

Ticket #15049: meta.php.diff

File meta.php.diff, 596 bytes (added by leogermani, 4 years ago)

patch for add_metadata function

  • wp-includes/meta.php

     
    5252 
    5353        $_meta_value = $meta_value; 
    5454        $meta_value = maybe_serialize( stripslashes_deep($meta_value) ); 
    55  
     55     
     56    if ( $wpdb->get_var( $wpdb->prepare( 
     57                "SELECT COUNT(*) FROM $table WHERE meta_key = %s AND $column = %d AND meta_value = %s", 
     58                $meta_key, $object_id, $meta_value ) ) ) 
     59                return false; 
     60     
    5661        $wpdb->insert( $table, array( 
    5762                $column => $object_id, 
    5863                'meta_key' => $meta_key,