Make WordPress Core


Ignore:
Timestamp:
03/20/2008 11:34:32 PM (17 years ago)
Author:
ryan
Message:

Capture last db error. Pass it in WP_Error data when term inserts fail. Fix typo in WP_Ajax_Response

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/taxonomy.php

    r7430 r7431  
    11541154    if ( ! $term_id = is_term($slug) ) {
    11551155        if ( false === $wpdb->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) ) )
    1156             return new WP_Error('db_insert_error', __('Could not insert term into the database'));
     1156            return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error);
    11571157        $term_id = (int) $wpdb->insert_id;
    11581158    } else if ( is_taxonomy_hierarchical($taxonomy) && !empty($parent) ) {
     
    11611161        $slug = wp_unique_term_slug($slug, (object) $args);
    11621162        if ( false === $wpdb->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) ) )
    1163             return new WP_Error('db_insert_error', __('Could not insert term into the database'));
     1163            return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error);
    11641164        $term_id = (int) $wpdb->insert_id;
    11651165    }
Note: See TracChangeset for help on using the changeset viewer.