Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#20072 closed defect (bug) (fixed)

get_the_tag_list should accept same arguments as get_the_category_list

Reported by: fireproofsocks Owned by: duck_
Milestone: 3.4 Priority: normal
Severity: normal Version: 3.3.1
Component: General Keywords: has-patch
Focuses: Cc:


It is bad form that the get_the_tag_list() relies on global variables to retrive tag information about a post. What if you want tag information about a post OTHER than the current post? The get_the_category_list() function is nearly identical in purpose, yet it does not suffer from this same restriction.

Compare the arguments here: http://codex.wordpress.org/Function_Reference/get_the_tag_list

To here: http://codex.wordpress.org/Function_Reference/get_the_category_list

I would expect these functions to have nearly identical inputs. If I am manually iterating over a list of post IDs (i.e. not in the loop), then it's a challenge to get the tag information here.

Attachments (2)

20072.diff (852 bytes) - added by kawauso 6 years ago.
Add $id param
20072.2.diff (2.1 KB) - added by duck_ 6 years ago.

Download all attachments as: .zip

Change History (7)

6 years ago

Add $id param

#1 @kawauso
6 years ago

  • Keywords has-patch added

#2 @kawauso
6 years ago

  • Milestone changed from Awaiting Review to 3.4

#3 @husobj
6 years ago

  • Cc ben@… added

6 years ago

#4 @duck_
6 years ago

20072.2.diff also removes the default value for the $id parameter on some of the term functions. This parameter isn't optional as it's followed by the non-optional $taxonomy. Also fixes a notice when passing $id = 0 to get_the_terms() and global $post isn't an object.

Also see #17558 for $id = 0 stuff.

#5 @duck_
6 years ago

  • Owner set to duck_
  • Resolution set to fixed
  • Status changed from new to closed

In [20549]:

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.

Note: See TracTickets for help on using tickets.