From 6d13f920fdec9fdc18999f447c09a096b8acf13e Mon Sep 17 00:00:00 2001 From: duck_ Date: Fri, 20 Apr 2012 10:06:05 +0000 Subject: [PATCH] Add $id parameter to get_the_tag_list() for consistency with get_the_(category|term)_list(). Props kawauso. Fixes #20072. Also remove 'default' value of 0 for $id parameter in generic taxonomy functions as it is a required parameter, and fix a notice when get_the_terms() is called when $id = 0 and the $post global is not an object. git-svn-id: http://svn.automattic.com/wordpress/trunk@20549 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/category-template.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/wp-includes/category-template.php b/wp-includes/category-template.php index 1b3c82e72..b71f79117 100644 --- a/wp-includes/category-template.php +++ b/wp-includes/category-template.php @@ -995,10 +995,11 @@ function get_the_tags( $id = 0 ) { * @param string $before Optional. Before tags. * @param string $sep Optional. Between tags. * @param string $after Optional. After tags. + * @param int $id Optional. Post ID. Defaults to the current post. * @return string */ -function get_the_tag_list( $before = '', $sep = '', $after = '' ) { - return apply_filters( 'the_tags', get_the_term_list( 0, 'post_tag', $before, $sep, $after ), $before, $sep, $after); +function get_the_tag_list( $before = '', $sep = '', $after = '', $id = 0 ) { + return apply_filters( 'the_tags', get_the_term_list( $id, 'post_tag', $before, $sep, $after ), $before, $sep, $after, $id ); } /** @@ -1053,17 +1054,17 @@ function term_description( $term = 0, $taxonomy = 'post_tag' ) { * * @since 2.5.0 * - * @param int $id Post ID. Is not optional. + * @param int $id Post ID. * @param string $taxonomy Taxonomy name. * @return array|bool False on failure. Array of term objects on success. */ -function get_the_terms( $id = 0, $taxonomy ) { +function get_the_terms( $id, $taxonomy ) { global $post; $id = (int) $id; if ( !$id ) { - if ( !$post->ID ) + if ( empty( $post->ID ) ) return false; else $id = (int) $post->ID; @@ -1095,7 +1096,7 @@ function get_the_terms( $id = 0, $taxonomy ) { * @param string $after Optional. After list. * @return string */ -function get_the_term_list( $id = 0, $taxonomy, $before = '', $sep = '', $after = '' ) { +function get_the_term_list( $id, $taxonomy, $before = '', $sep = '', $after = '' ) { $terms = get_the_terms( $id, $taxonomy ); if ( is_wp_error( $terms ) ) @@ -1128,7 +1129,7 @@ function get_the_term_list( $id = 0, $taxonomy, $before = '', $sep = '', $after * @param string $after Optional. After list. * @return null|bool False on WordPress error. Returns null when displaying. */ -function the_terms( $id = 0, $taxonomy, $before = '', $sep = ', ', $after = '' ) { +function the_terms( $id, $taxonomy, $before = '', $sep = ', ', $after = '' ) { $term_list = get_the_term_list( $id, $taxonomy, $before, $sep, $after ); if ( is_wp_error( $term_list ) )