WordPress.org

Make WordPress Core

Changeset 14723


Ignore:
Timestamp:
05/18/10 15:03:54 (5 years ago)
Author:
ryan
Message:

Fix adding categories via bulk edit. Props duck_. see #13397

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/post.php

    r14650 r14723  
    312312 
    313313        $tax_names = get_object_taxonomies( get_post($post_ID) ); 
    314         if ( isset($new_cats) && in_array( 'category', $tax_names ) ) { 
    315             $cats = (array) wp_get_post_categories($post_ID); 
    316             $post_data['post_category'] = array_unique( array_merge($cats, $new_cats) ); 
    317         } 
    318  
    319314        foreach ( $tax_names as $tax_name ) { 
    320315            $taxonomy_obj = get_taxonomy($tax_name); 
    321             if(  isset( $tax_input[$tax_name]) && current_user_can( $taxonomy_obj->cap->assign_terms ) ) 
     316            if (  isset( $tax_input[$tax_name]) && current_user_can( $taxonomy_obj->cap->assign_terms ) ) 
    322317                $new_terms = $tax_input[$tax_name]; 
    323318            else  
     
    330325 
    331326            $post_data['tax_input'][$tax_name] = array_merge( $current_terms, $new_terms ); 
     327        } 
     328         
     329        if ( isset($new_cats) && in_array( 'category', $tax_names ) ) { 
     330            $cats = (array) wp_get_post_categories($post_ID); 
     331            $post_data['post_category'] = array_unique( array_merge($cats, $new_cats) ); 
     332            unset( $post_data['tax_input']['category'] ); 
    332333        } 
    333334 
Note: See TracChangeset for help on using the changeset viewer.