Changeset 21735 for trunk/wp-includes/category-template.php
- Timestamp:
- 09/04/2012 04:29:28 PM (14 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/category-template.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/category-template.php
r20675 r21735 1055 1055 * @since 2.5.0 1056 1056 * 1057 * @param int $id Post ID.1057 * @param mixed $post Post ID or object. 1058 1058 * @param string $taxonomy Taxonomy name. 1059 1059 * @return array|bool False on failure. Array of term objects on success. 1060 1060 */ 1061 function get_the_terms( $id, $taxonomy ) { 1062 global $post; 1063 1064 $id = (int) $id; 1065 1066 if ( !$id ) { 1067 if ( empty( $post->ID ) ) 1068 return false; 1069 else 1070 $id = (int) $post->ID; 1071 } 1072 1073 $terms = get_object_term_cache( $id, $taxonomy ); 1061 function get_the_terms( $post, $taxonomy ) { 1062 if ( ! $post = get_post( $post ) ) 1063 return false; 1064 1065 $terms = get_object_term_cache( $post->ID, $taxonomy ); 1074 1066 if ( false === $terms ) { 1075 $terms = wp_get_object_terms( $ id, $taxonomy );1076 wp_cache_add($ id, $terms, $taxonomy . '_relationships');1077 } 1078 1079 $terms = apply_filters( 'get_the_terms', $terms, $ id, $taxonomy );1067 $terms = wp_get_object_terms( $post->ID, $taxonomy ); 1068 wp_cache_add($post->ID, $terms, $taxonomy . '_relationships'); 1069 } 1070 1071 $terms = apply_filters( 'get_the_terms', $terms, $post->ID, $taxonomy ); 1080 1072 1081 1073 if ( empty( $terms ) )
Note: See TracChangeset
for help on using the changeset viewer.