Make WordPress Core

Changeset 7430


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

Return error if term DB insert fails

File:
1 edited

Legend:

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

    r6983 r7430  
    11531153
    11541154    if ( ! $term_id = is_term($slug) ) {
    1155         $wpdb->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) );
     1155        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'));
    11561157        $term_id = (int) $wpdb->insert_id;
    11571158    } else if ( is_taxonomy_hierarchical($taxonomy) && !empty($parent) ) {
     
    11591160        // by incorporating parent slugs.
    11601161        $slug = wp_unique_term_slug($slug, (object) $args);
    1161         $wpdb->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) );
     1162        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'));
    11621164        $term_id = (int) $wpdb->insert_id;
    11631165    }
Note: See TracChangeset for help on using the changeset viewer.