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