WordPress.org

Make WordPress Core

Ticket #22191: 22191.diff

File 22191.diff, 1002 bytes (added by nacin, 19 months ago)
  • wp-includes/meta.php

     
    123123        if ( null !== $check ) 
    124124                return (bool) $check; 
    125125 
    126         if ( ! $meta_id = $wpdb->get_var( $wpdb->prepare( "SELECT $id_column FROM $table WHERE meta_key = %s AND $column = %d", $meta_key, $object_id ) ) ) 
    127                 return add_metadata($meta_type, $object_id, $meta_key, $passed_value); 
    128  
    129126        // Compare existing value to new value if no prev value given and the key exists only once. 
    130127        if ( empty($prev_value) ) { 
    131128                $old_value = get_metadata($meta_type, $object_id, $meta_key); 
     
    135132                } 
    136133        } 
    137134 
     135        if ( ! $meta_id = $wpdb->get_var( $wpdb->prepare( "SELECT $id_column FROM $table WHERE meta_key = %s AND $column = %d", $meta_key, $object_id ) ) ) 
     136                return add_metadata($meta_type, $object_id, $meta_key, $passed_value); 
     137 
    138138        $_meta_value = $meta_value; 
    139139        $meta_value = maybe_serialize( $meta_value ); 
    140140