Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#29756 closed defect (bug) (duplicate)

get_tags() returns incorrect variable type in tag object

Reported by: jsavage37's profile jsavage37 Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.0
Component: Taxonomy Keywords:
Focuses: Cc:


I'm running a simple get_tags() and then looping through the tags as such:

$tags = get_tags();
global $wp_query;
foreach ($tags as $tag) :

    <a href="<?php echo get_tag_link((int)$tag->term_id); ?>"><?php echo $tag->name; ?></a>

<?php endif;

See how I have to cast the term ID as an int? The doing a gettype($tag->term_id) revealed that the object itself was storing a string. After checking the documentation, that's supposed to be returned as a bigint.

Change History (1)

#1 @SergeyBiryukov
10 years ago

  • Component changed from General to Taxonomy
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #16101.

Note: See TracTickets for help on using tickets.