diff --git a/src/wp-includes/taxonomy.php b/src/wp-includes/taxonomy.php index 12864b343a..9f84855257 100644 --- a/src/wp-includes/taxonomy.php +++ b/src/wp-includes/taxonomy.php @@ -2276,7 +2276,11 @@ function wp_insert_term( $term, $taxonomy, $args = array() ) { 'term_taxonomy_id' => $tt_id, ); } - $wpdb->insert( $wpdb->term_taxonomy, compact( 'term_id', 'taxonomy', 'description', 'parent' ) + array( 'count' => 0 ) ); + + if ( false === $wpdb->insert( $wpdb->term_taxonomy, compact( 'term_id', 'taxonomy', 'description', 'parent' ) + array( 'count' => 0 ) ) ) { + return new WP_Error( 'db_insert_error', __( 'Could not insert term taxonomy into the database.' ), $wpdb->last_error ); + } + $tt_id = (int) $wpdb->insert_id; /*