diff --git wp-includes/category-template.php wp-includes/category-template.php
index 96a61cf..87ea722 100644
|
|
function term_description( $term = 0, $taxonomy = 'post_tag' ) { |
1053 | 1053 | * |
1054 | 1054 | * @since 2.5.0 |
1055 | 1055 | * |
| 1056 | * @see wp_get_object_terms() for reference on the $args param |
| 1057 | * |
1056 | 1058 | * @param int|object $post Post ID or object. |
1057 | 1059 | * @param string $taxonomy Taxonomy name. |
| 1060 | * @param array $args Accepts the same arguments as the $args param for wp_get_object_terms. |
1058 | 1061 | * @return array|bool|WP_Error Array of term objects on success, false or WP_Error on failure. |
1059 | 1062 | */ |
1060 | | function get_the_terms( $post, $taxonomy ) { |
| 1063 | function get_the_terms( $post, $taxonomy, $args = array() ) { |
1061 | 1064 | if ( ! $post = get_post( $post ) ) |
1062 | 1065 | return false; |
1063 | 1066 | |
1064 | | $terms = get_object_term_cache( $post->ID, $taxonomy ); |
| 1067 | $key = "{$post->ID}:$taxonomy:" . md5( serialize( $args ) ); |
| 1068 | $group = "{$taxonomy}_relationships"; |
| 1069 | $terms = wp_cache_get( $key, $group ); |
| 1070 | |
1065 | 1071 | if ( false === $terms ) { |
1066 | | $terms = wp_get_object_terms( $post->ID, $taxonomy ); |
1067 | | wp_cache_add($post->ID, $terms, $taxonomy . '_relationships'); |
| 1072 | $terms = wp_get_object_terms( $post->ID, $taxonomy, $args ); |
| 1073 | wp_cache_add( $key, $terms, $group ); |
1068 | 1074 | } |
1069 | 1075 | |
1070 | 1076 | $terms = apply_filters( 'get_the_terms', $terms, $post->ID, $taxonomy ); |
… |
… |
function get_the_terms( $post, $taxonomy ) { |
1080 | 1086 | * |
1081 | 1087 | * @since 2.5.0 |
1082 | 1088 | * |
| 1089 | * @see wp_get_object_terms() for reference on the $args param |
| 1090 | * |
1083 | 1091 | * @param int $id Post ID. |
1084 | 1092 | * @param string $taxonomy Taxonomy name. |
1085 | 1093 | * @param string $before Optional. Before list. |
1086 | 1094 | * @param string $sep Optional. Separate items using this. |
1087 | 1095 | * @param string $after Optional. After list. |
| 1096 | * @param array $args Accepts the same arguments as the $args param for wp_get_object_terms. |
1088 | 1097 | * @return string|bool|WP_Error A list of terms on success, false or WP_Error on failure. |
1089 | 1098 | */ |
1090 | | function get_the_term_list( $id, $taxonomy, $before = '', $sep = '', $after = '' ) { |
1091 | | $terms = get_the_terms( $id, $taxonomy ); |
| 1099 | function get_the_term_list( $id, $taxonomy, $before = '', $sep = '', $after = '', $args = array() ) { |
| 1100 | $terms = get_the_terms( $id, $taxonomy, $args ); |
1092 | 1101 | |
1093 | 1102 | if ( is_wp_error( $terms ) ) |
1094 | 1103 | return $terms; |
… |
… |
function get_the_term_list( $id, $taxonomy, $before = '', $sep = '', $after = '' |
1113 | 1122 | * |
1114 | 1123 | * @since 2.5.0 |
1115 | 1124 | * |
| 1125 | * @see wp_get_object_terms() for reference on the $args param |
| 1126 | * |
1116 | 1127 | * @param int $id Post ID. |
1117 | 1128 | * @param string $taxonomy Taxonomy name. |
1118 | 1129 | * @param string $before Optional. Before list. |
1119 | 1130 | * @param string $sep Optional. Separate items using this. |
1120 | 1131 | * @param string $after Optional. After list. |
| 1132 | * @param array $args Accepts the same arguments as the $args param for wp_get_object_terms. |
1121 | 1133 | * @return null|bool False on WordPress error. Returns null when displaying. |
1122 | 1134 | */ |
1123 | | function the_terms( $id, $taxonomy, $before = '', $sep = ', ', $after = '' ) { |
1124 | | $term_list = get_the_term_list( $id, $taxonomy, $before, $sep, $after ); |
| 1135 | function the_terms( $id, $taxonomy, $before = '', $sep = ', ', $after = '', $args = array() ) { |
| 1136 | $term_list = get_the_term_list( $id, $taxonomy, $before, $sep, $after, $args ); |
1125 | 1137 | |
1126 | 1138 | if ( is_wp_error( $term_list ) ) |
1127 | 1139 | return false; |
1128 | 1140 | |
1129 | | echo apply_filters('the_terms', $term_list, $taxonomy, $before, $sep, $after); |
| 1141 | echo apply_filters( 'the_terms', $term_list, $taxonomy, $before, $sep, $after ); |
1130 | 1142 | } |
1131 | 1143 | |
1132 | 1144 | /** |