Changeset 21981
- Timestamp:
- 09/24/2012 08:35:56 PM (12 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/category-template.php
r21735 r21981 1063 1063 return false; 1064 1064 1065 if ( ! is_object_in_taxonomy( $post->post_type, $taxonomy ) ) 1066 return false; 1067 1065 1068 $terms = get_object_term_cache( $post->ID, $taxonomy ); 1066 1069 if ( false === $terms ) { -
trunk/wp-includes/post.php
r21967 r21981 497 497 498 498 if ( 'post_category' == $key ) { 499 if ( is_object_in_taxonomy( $this->post_type, 'category' ) ) 500 return wp_get_post_categories( $this->ID ); 501 else 499 $terms = get_the_terms( $this, 'category' ); 500 if ( ! $terms ) 502 501 return array(); 502 503 return wp_list_pluck( $terms, 'term_id' ); 503 504 } 504 505 505 506 if ( 'tags_input' == $key ) { 506 if ( is_object_in_taxonomy( $this->post_type, 'post_tag' ) ) 507 return wp_get_post_tags( $this->ID, array( 'fields' => 'names' ) ); 508 else 507 $terms = get_the_terms( $this, 'post_tag' ); 508 if ( ! $terms ) 509 509 return array(); 510 511 return wp_list_pluck( $terms, 'name' ); 510 512 } 511 513 … … 3042 3044 // names but different parents aren't confused. 3043 3045 if ( is_taxonomy_hierarchical( $taxonomy ) ) { 3044 $tags = array_map( 'intval', $tags ); 3045 $tags = array_unique( $tags ); 3046 } 3047 3048 return wp_set_object_terms($post_id, $tags, $taxonomy, $append); 3046 $tags = array_unique( array_map( 'intval', $tags ) ); 3047 } 3048 3049 $r = wp_set_object_terms( $post_id, $tags, $taxonomy, $append ); 3050 if ( is_wp_error( $r ) ) 3051 return $r; 3052 3053 wp_cache_delete( $post_id, $taxonomy . '_relationships' ); 3054 3055 return $r; 3049 3056 } 3050 3057 … … 3075 3082 } 3076 3083 3077 if ( !empty($post_categories) ) { 3078 $post_categories = array_map('intval', $post_categories); 3079 $post_categories = array_unique($post_categories); 3080 } 3081 3082 return wp_set_object_terms($post_ID, $post_categories, 'category'); 3084 return wp_set_post_terms($post_ID, $post_categories, 'category'); 3083 3085 } 3084 3086
Note: See TracChangeset
for help on using the changeset viewer.