Ticket #19954: 19954.patch
File 19954.patch, 1.0 KB (added by , 12 years ago) |
---|
-
wp-includes/post.php
2466 2466 // Make sure we set a valid category. 2467 2467 if ( empty($post_category) || 0 == count($post_category) || !is_array($post_category) ) { 2468 2468 // 'post' requires at least one category. 2469 if ( 'post' == $post_type && 'auto-draft' != $post_status)2469 if( 'post' == $post_type && 'auto-draft' != $post_status && ( !isset( $ID ) || ! has_category( '', get_post( $ID ) ) ) ) 2470 2470 $post_category = array( get_option('default_category') ); 2471 2471 else 2472 2472 $post_category = array(); … … 2609 2609 $wpdb->update( $wpdb->posts, array( 'post_name' => $data['post_name'] ), $where ); 2610 2610 } 2611 2611 2612 if ( is_object_in_taxonomy($post_type, 'category') )2612 if ( is_object_in_taxonomy($post_type, 'category') && !empty( $post_category ) ) 2613 2613 wp_set_post_categories( $post_ID, $post_category ); 2614 2614 2615 2615 if ( isset( $tags_input ) && is_object_in_taxonomy($post_type, 'post_tag') )