diff options
| author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2008-06-10 14:08:54 +0000 |
|---|---|---|
| committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2008-06-10 14:08:54 +0000 |
| commit | 310940b824eff4a116dcd72ccd339bb602021981 (patch) | |
| tree | 19f6efc7b30b9456eebc26d578c5dc7e125bb6e7 /wp-includes/taxonomy.php | |
| parent | 616f7399dc4c4f7c56951c7b87a7aa91b3e690a3 (diff) | |
| download | wordpress-mu-310940b824eff4a116dcd72ccd339bb602021981.tar.gz wordpress-mu-310940b824eff4a116dcd72ccd339bb602021981.tar.xz wordpress-mu-310940b824eff4a116dcd72ccd339bb602021981.zip | |
Merge with branches/2.5 in WordPress, revision 8066
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1324 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/taxonomy.php')
| -rw-r--r-- | wp-includes/taxonomy.php | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index cc16a61..4418e99 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -1058,14 +1058,14 @@ function wp_get_object_terms($object_ids, $taxonomies, $args = array()) { if ( count($taxonomies) > 1 ) { foreach ( $taxonomies as $index => $taxonomy ) { $t = get_taxonomy($taxonomy); - if ( is_array($t->args) && $args != array_merge($args, $t->args) ) { + if ( isset($t->args) && is_array($t->args) && $args != array_merge($args, $t->args) ) { unset($taxonomies[$index]); $terms = array_merge($terms, wp_get_object_terms($object_ids, $taxonomy, array_merge($args, $t->args))); } } } else { $t = get_taxonomy($taxonomies[0]); - if ( is_array($t->args) ) + if ( isset($t->args) && is_array($t->args) ) $args = array_merge($args, $t->args); } @@ -1199,14 +1199,16 @@ function wp_insert_term( $term, $taxonomy, $args = array() ) { if ( ! $term_id = is_term($slug) ) { $maxterm = $wpdb->get_var( "SELECT max(term_id) FROM {$wpdb->terms}" ); $term_id = mt_rand( $maxterm+100, $maxterm+4000 ); - $wpdb->query("INSERT INTO $wpdb->terms (term_id, name, slug, term_group) VALUES ('$term_id', '$name', '$slug', '$term_group')"); + if ( false === $wpdb->insert( $wpdb->terms, compact( 'term_id', 'name', 'slug', 'term_group' ) ) ) + return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error); } 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); $maxterm = $wpdb->get_var( "SELECT max(term_id) FROM {$wpdb->terms}" ); $term_id = mt_rand( $maxterm+100, $maxterm+4000 ); - $wpdb->query("INSERT INTO $wpdb->terms (term_id, name, slug, term_group) VALUES ('$term_id', '$name', '$slug', '$term_group')"); + if ( false === $wpdb->insert( $wpdb->terms, compact( 'term_id','name', 'slug', 'term_group' ) ) ) + return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error); } if ( empty($slug) ) { |
