From aab2aeaa75d9add0a3a5b5b0b0d4e32c0f3a3a65 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Tue, 18 May 2010 15:03:54 +0000 Subject: [PATCH] Fix adding categories via bulk edit. Props duck_. see #13397 git-svn-id: https://develop.svn.wordpress.org/trunk@14723 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/post.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php index af4242d47c..c57791be23 100644 --- a/wp-admin/includes/post.php +++ b/wp-admin/includes/post.php @@ -311,14 +311,9 @@ function bulk_edit_posts( $post_data = null ) { } $tax_names = get_object_taxonomies( get_post($post_ID) ); - if ( isset($new_cats) && in_array( 'category', $tax_names ) ) { - $cats = (array) wp_get_post_categories($post_ID); - $post_data['post_category'] = array_unique( array_merge($cats, $new_cats) ); - } - foreach ( $tax_names as $tax_name ) { $taxonomy_obj = get_taxonomy($tax_name); - if( isset( $tax_input[$tax_name]) && current_user_can( $taxonomy_obj->cap->assign_terms ) ) + if ( isset( $tax_input[$tax_name]) && current_user_can( $taxonomy_obj->cap->assign_terms ) ) $new_terms = $tax_input[$tax_name]; else $new_terms = array(); @@ -330,6 +325,12 @@ function bulk_edit_posts( $post_data = null ) { $post_data['tax_input'][$tax_name] = array_merge( $current_terms, $new_terms ); } + + if ( isset($new_cats) && in_array( 'category', $tax_names ) ) { + $cats = (array) wp_get_post_categories($post_ID); + $post_data['post_category'] = array_unique( array_merge($cats, $new_cats) ); + unset( $post_data['tax_input']['category'] ); + } $post_data['ID'] = $post_ID; $updated[] = wp_update_post( $post_data );