diff --git wp-includes/category-template.php wp-includes/category-template.php
index c4ba37d..fea6979 100644
|
|
|
function get_the_terms( $post, $taxonomy ) { |
| 1062 | 1062 | if ( ! $post = get_post( $post ) ) |
| 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 ) { |
| 1067 | 1070 | $terms = wp_get_object_terms( $post->ID, $taxonomy ); |
diff --git wp-includes/post.php wp-includes/post.php
index cac125e..94e7447 100644
|
|
|
final class WP_Post { |
| 495 | 495 | } |
| 496 | 496 | |
| 497 | 497 | if ( 'post_category' == $key ) { |
| 498 | | if ( is_object_in_taxonomy( $this->post_type, 'category' ) ) |
| 499 | | return wp_get_post_categories( $this->ID ); |
| 500 | | else |
| | 498 | $terms = get_the_terms( $this, 'category' ); |
| | 499 | if ( !$terms ) |
| 501 | 500 | return array(); |
| | 501 | |
| | 502 | return wp_list_pluck( $terms, 'term_id' ); |
| 502 | 503 | } |
| 503 | 504 | |
| 504 | 505 | if ( 'tags_input' == $key ) { |
| 505 | | if ( is_object_in_taxonomy( $this->post_type, 'post_tag' ) ) |
| 506 | | return wp_get_post_tags( $this->ID, array( 'fields' => 'names' ) ); |
| 507 | | else |
| | 506 | $terms = get_the_terms( $this, 'post_tag' ); |
| | 507 | if ( !$terms ) |
| 508 | 508 | return array(); |
| | 509 | |
| | 510 | return wp_list_pluck( $terms, 'name' ); |
| 509 | 511 | } |
| 510 | 512 | |
| 511 | 513 | // Rest of the values need filtering |
| … |
… |
function wp_set_post_terms( $post_id = 0, $tags = '', $taxonomy = 'post_tag', $a |
| 3043 | 3045 | // Hierarchical taxonomies must always pass IDs rather than names so that children with the same |
| 3044 | 3046 | // names but different parents aren't confused. |
| 3045 | 3047 | if ( is_taxonomy_hierarchical( $taxonomy ) ) { |
| 3046 | | $tags = array_map( 'intval', $tags ); |
| 3047 | | $tags = array_unique( $tags ); |
| | 3048 | $tags = array_unique( array_map( 'intval', $tags ) ); |
| 3048 | 3049 | } |
| 3049 | 3050 | |
| 3050 | | return wp_set_object_terms($post_id, $tags, $taxonomy, $append); |
| | 3051 | $r = wp_set_object_terms( $post_id, $tags, $taxonomy, $append ); |
| | 3052 | if ( is_wp_error( $r ) ) |
| | 3053 | return $r; |
| | 3054 | |
| | 3055 | wp_cache_delete( $post_id, $taxonomy . '_relationships' ); |
| | 3056 | |
| | 3057 | return $r; |
| 3051 | 3058 | } |
| 3052 | 3059 | |
| 3053 | 3060 | /** |
| … |
… |
function wp_set_post_categories($post_ID = 0, $post_categories = array()) { |
| 3076 | 3083 | return true; |
| 3077 | 3084 | } |
| 3078 | 3085 | |
| 3079 | | if ( !empty($post_categories) ) { |
| 3080 | | $post_categories = array_map('intval', $post_categories); |
| 3081 | | $post_categories = array_unique($post_categories); |
| 3082 | | } |
| 3083 | | |
| 3084 | | return wp_set_object_terms($post_ID, $post_categories, 'category'); |
| | 3086 | return wp_set_post_terms($post_ID, $post_categories, 'category'); |
| 3085 | 3087 | } |
| 3086 | 3088 | |
| 3087 | 3089 | /** |