Ticket #4123 (closed enhancement: fixed)

Opened 2 years ago

Last modified 2 years ago

New function get_the_tag similar to get_the_category w/ patch

Reported by: tacker Assigned to: anonymous
Priority: low Milestone: 2.2
Component: Template Version:
Severity: normal Keywords:
Cc:

Description

  • wp-includes/category-template.php

    old new  
    203203       echo get_the_tags( $before, $sep, $after ); 
    204204} 
    205205 
     206function get_the_tag($id = 0) { 
     207    global $post; 
     208    if ( !$post ) 
     209        return false; // in-the-loop function 
     210 
     211    $id = (int) $id; 
     212    if ( !$id ) 
     213        $id = (int) $post->ID; 
     214 
     215    $tags = get_post_tags( $post->ID ); 
     216    if ( empty( $tags ) ) 
     217        return false; 
     218 
     219    return $tags; 
     220} 
     221 
    206222function category_description($category = 0) { 
    207223       global $cat; 
    208224       if ( !$category ) 

Change History

04/10/07 09:27:34 changed by tacker

  • type changed from task to enhancement.

04/10/07 17:04:13 changed by foolswisdom

  • milestone set to 2.2.

04/10/07 18:38:42 changed by ryan

To be more consistent with the category API, your code in get_the_tag() should replace the code in get_the_tags(), and the code currently in get_the_tags() should be in the_tags().

04/10/07 21:23:12 changed by ryan

  • status changed from new to closed.
  • resolution set to fixed.

(In [5235]) Change get_the_tags() to return an array of tags. Move tag list code to the_tags(). fixes #4123