WordPress.org

Make WordPress Core


Ignore:
Timestamp:
04/20/2012 10:06:05 AM (9 years ago)
Author:
duck_
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/category-template.php

    r20023 r20549  
    996996 * @param string $sep Optional. Between tags.
    997997 * @param string $after Optional. After tags.
     998 * @param int $id Optional. Post ID. Defaults to the current post.
    998999 * @return string
    9991000 */
    1000 function get_the_tag_list( $before = '', $sep = '', $after = '' ) {
    1001     return apply_filters( 'the_tags', get_the_term_list( 0, 'post_tag', $before, $sep, $after ), $before, $sep, $after);
     1001function get_the_tag_list( $before = '', $sep = '', $after = '', $id = 0 ) {
     1002    return apply_filters( 'the_tags', get_the_term_list( $id, 'post_tag', $before, $sep, $after ), $before, $sep, $after, $id );
    10021003}
    10031004
     
    10541055 * @since 2.5.0
    10551056 *
    1056  * @param int $id Post ID. Is not optional.
     1057 * @param int $id Post ID.
    10571058 * @param string $taxonomy Taxonomy name.
    10581059 * @return array|bool False on failure. Array of term objects on success.
    10591060 */
    1060 function get_the_terms( $id = 0, $taxonomy ) {
     1061function get_the_terms( $id, $taxonomy ) {
    10611062    global $post;
    10621063
     
    10641065
    10651066    if ( !$id ) {
    1066         if ( !$post->ID )
     1067        if ( empty( $post->ID ) )
    10671068            return false;
    10681069        else
     
    10961097 * @return string
    10971098 */
    1098 function get_the_term_list( $id = 0, $taxonomy, $before = '', $sep = '', $after = '' ) {
     1099function get_the_term_list( $id, $taxonomy, $before = '', $sep = '', $after = '' ) {
    10991100    $terms = get_the_terms( $id, $taxonomy );
    11001101
     
    11291130 * @return null|bool False on WordPress error. Returns null when displaying.
    11301131 */
    1131 function the_terms( $id = 0, $taxonomy, $before = '', $sep = ', ', $after = '' ) {
     1132function the_terms( $id, $taxonomy, $before = '', $sep = ', ', $after = '' ) {
    11321133    $term_list = get_the_term_list( $id, $taxonomy, $before, $sep, $after );
    11331134
Note: See TracChangeset for help on using the changeset viewer.