WordPress.org

Make WordPress Core

Ticket #21800: 21800.patch

File 21800.patch, 994 bytes (added by SergeyBiryukov, 6 years ago)
  • wp-includes/taxonomy.php

     
    22212221                        if ( in_array($tt_id, $final_tt_ids) )
    22222222                                $values[] = $wpdb->prepare( "(%d, %d, %d)", $object_id, $tt_id, ++$term_order);
    22232223                if ( $values )
    2224                         $wpdb->query("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id, term_order) VALUES " . join(',', $values) . " ON DUPLICATE KEY UPDATE term_order = VALUES(term_order)");
     2224                        if ( false === $wpdb->query( "INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id, term_order) VALUES " . join( ',', $values ) . " ON DUPLICATE KEY UPDATE term_order = VALUES(term_order)" ) )
     2225                                return new WP_Error( 'db_insert_error', __( 'Could not insert term relationship into the database' ), $wpdb->last_error );
    22252226        }
    22262227
    22272228        do_action('set_object_terms', $object_id, $terms, $tt_ids, $taxonomy, $append, $old_tt_ids);