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