Index: post.php
===================================================================
--- post.php	(revision 27894)
+++ post.php	(working copy)
@@ -3042,7 +3042,7 @@
 	}
 
 	if ( is_object_in_taxonomy($post_type, 'category') )
-		wp_set_post_categories( $post_ID, $post_category );
+		wp_set_post_categories( $post_ID, $post_category, false, $post_type, $post_status );
 
 	if ( isset( $tags_input ) && is_object_in_taxonomy($post_type, 'post_tag') )
 		wp_set_post_tags( $post_ID, $tags_input );
@@ -3396,12 +3396,16 @@
  * @param int $post_ID Post ID.
  * @param array|int $post_categories Optional. List of categories or ID of category.
  * @param bool $append If true, don't delete existing categories, just add on. If false, replace the categories with the new categories.
+ * @param string $post_type Optional post type
+ * @param string $post_status Optional post status
  * @return bool|mixed
  */
-function wp_set_post_categories( $post_ID = 0, $post_categories = array(), $append = false ) {
+function wp_set_post_categories( $post_ID = 0, $post_categories = array(), $append = false, $post_type = '', $post_status = ''  ) {
 	$post_ID = (int) $post_ID;
-	$post_type = get_post_type( $post_ID );
-	$post_status = get_post_status( $post_ID );
+	if( !$post_type )
+		$post_type = get_post_type( $post_ID );
+    if( !$post_status )
+		$post_status = get_post_status( $post_ID );
 	// If $post_categories isn't already an array, make it one:
 	$post_categories = (array) $post_categories;
 	if ( empty( $post_categories ) ) {
@@ -4271,7 +4275,7 @@
 	}
 
 	if ( is_object_in_taxonomy($post_type, 'category') )
-		wp_set_post_categories( $post_ID, $post_category );
+		wp_set_post_categories( $post_ID, $post_category, false, $post_type, $post_status );
 
 	if ( isset( $tags_input ) && is_object_in_taxonomy($post_type, 'post_tag') )
 		wp_set_post_tags( $post_ID, $tags_input );
