Ticket #27736: 27736.post.php.4.patch
File 27736.post.php.4.patch, 2.1 KB (added by , 11 years ago) |
---|
-
post.php
3041 3041 $wpdb->update( $wpdb->posts, array( 'post_name' => $data['post_name'] ), $where ); 3042 3042 } 3043 3043 3044 if ( is_object_in_taxonomy($post_type, 'category') ) 3045 wp_set_post_categories( $post_ID, $post_category ); 3044 if ( is_object_in_taxonomy($post_type, 'category') ) { 3045 wp_set_post_categories( $post_ID, $post_category, false, $post_type, $post_status ); 3046 } 3046 3047 3047 3048 if ( isset( $tags_input ) && is_object_in_taxonomy($post_type, 'post_tag') ) 3048 3049 wp_set_post_tags( $post_ID, $tags_input ); … … 3396 3397 * @param int $post_ID Post ID. 3397 3398 * @param array|int $post_categories Optional. List of categories or ID of category. 3398 3399 * @param bool $append If true, don't delete existing categories, just add on. If false, replace the categories with the new categories. 3400 * @param string $post_type Optional post type 3401 * @param string $post_status Optional post status 3399 3402 * @return bool|mixed 3400 3403 */ 3401 function wp_set_post_categories( $post_ID = 0, $post_categories = array(), $append = false ) {3404 function wp_set_post_categories( $post_ID = 0, $post_categories = array(), $append = false, $post_type = '', $post_status = '' ) { 3402 3405 $post_ID = (int) $post_ID; 3403 $post_type = get_post_type( $post_ID ); 3404 $post_status = get_post_status( $post_ID ); 3406 if( !$post_type ) { 3407 $post_type = get_post_type( $post_ID ); 3408 } 3409 if( !$post_status ) { 3410 $post_status = get_post_status( $post_ID ); 3411 } 3405 3412 // If $post_categories isn't already an array, make it one: 3406 3413 $post_categories = (array) $post_categories; 3407 3414 if ( empty( $post_categories ) ) { … … 4270 4277 $wpdb->update( $wpdb->posts, compact("post_name"), array( 'ID' => $post_ID ) ); 4271 4278 } 4272 4279 4273 if ( is_object_in_taxonomy($post_type, 'category') ) 4274 wp_set_post_categories( $post_ID, $post_category ); 4280 if ( is_object_in_taxonomy($post_type, 'category') ) { 4281 wp_set_post_categories( $post_ID, $post_category, false, $post_type, $post_status ); 4282 } 4275 4283 4276 4284 if ( isset( $tags_input ) && is_object_in_taxonomy($post_type, 'post_tag') ) 4277 4285 wp_set_post_tags( $post_ID, $tags_input );