diff --git a/wp-includes/classes.php b/wp-includes/classes.php index 7cf3eed201..3bf318db61 100644 --- a/wp-includes/classes.php +++ b/wp-includes/classes.php @@ -764,7 +764,7 @@ class WP_Ajax_Response { $response .= ""; if ( is_scalar($error_data) ) { - $response .= ""; + $response .= ""; } elseif ( is_array($error_data) ) { foreach ( $error_data as $k => $v ) $response .= "<$k>"; diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index 41d1035d94..035567c0e7 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -1153,14 +1153,14 @@ function wp_insert_term( $term, $taxonomy, $args = array() ) { if ( ! $term_id = is_term($slug) ) { if ( false === $wpdb->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) ) ) - return new WP_Error('db_insert_error', __('Could not insert term into the database')); + return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error); $term_id = (int) $wpdb->insert_id; } else if ( is_taxonomy_hierarchical($taxonomy) && !empty($parent) ) { // If the taxonomy supports hierarchy and the term has a parent, make the slug unique // by incorporating parent slugs. $slug = wp_unique_term_slug($slug, (object) $args); if ( false === $wpdb->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) ) ) - return new WP_Error('db_insert_error', __('Could not insert term into the database')); + return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error); $term_id = (int) $wpdb->insert_id; } diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index f52d286c50..216c9cf027 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -18,6 +18,7 @@ class wpdb { var $show_errors = false; var $suppress_errors = false; + var $last_error = ''; var $num_queries = 0; var $last_query; var $col_info; @@ -278,7 +279,7 @@ class wpdb { $this->queries[] = array( $query, $this->timer_stop(), $this->get_caller() ); // If there is an error then take note of it.. - if ( mysql_error($this->dbh) ) { + if ( $this->last_error = mysql_error($this->dbh) ) { $this->print_error(); return false; }