diff -r f507feede89a -r 09a1c134465b web/wp-includes/category-template.php --- a/web/wp-includes/category-template.php Wed Dec 19 12:35:13 2012 -0800 +++ b/web/wp-includes/category-template.php Wed Dec 19 17:46:52 2012 -0800 @@ -41,7 +41,7 @@ */ function get_category_parents( $id, $link = false, $separator = '/', $nicename = false, $visited = array() ) { $chain = ''; - $parent = &get_category( $id ); + $parent = get_category( $id ); if ( is_wp_error( $parent ) ) return $parent; @@ -73,7 +73,7 @@ */ function get_the_category( $id = false ) { $categories = get_the_terms( $id, 'category' ); - if ( ! $categories ) + if ( ! $categories || is_wp_error( $categories ) ) $categories = array(); $categories = array_values( $categories ); @@ -135,7 +135,7 @@ */ function get_the_category_by_ID( $cat_ID ) { $cat_ID = (int) $cat_ID; - $category = &get_category( $cat_ID ); + $category = get_category( $cat_ID ); if ( is_wp_error( $category ) ) return $category; return $category->name; @@ -1054,29 +1054,21 @@ * * @since 2.5.0 * - * @param int $id Post ID. + * @param mixed $post Post ID or object. * @param string $taxonomy Taxonomy name. * @return array|bool False on failure. Array of term objects on success. */ -function get_the_terms( $id, $taxonomy ) { - global $post; - - $id = (int) $id; +function get_the_terms( $post, $taxonomy ) { + if ( ! $post = get_post( $post ) ) + return false; - if ( !$id ) { - if ( empty( $post->ID ) ) - return false; - else - $id = (int) $post->ID; + $terms = get_object_term_cache( $post->ID, $taxonomy ); + if ( false === $terms ) { + $terms = wp_get_object_terms( $post->ID, $taxonomy ); + wp_cache_add($post->ID, $terms, $taxonomy . '_relationships'); } - $terms = get_object_term_cache( $id, $taxonomy ); - if ( false === $terms ) { - $terms = wp_get_object_terms( $id, $taxonomy ); - wp_cache_add($id, $terms, $taxonomy . '_relationships'); - } - - $terms = apply_filters( 'get_the_terms', $terms, $id, $taxonomy ); + $terms = apply_filters( 'get_the_terms', $terms, $post->ID, $taxonomy ); if ( empty( $terms ) ) return false;