Opened 12 years ago
Closed 12 years ago
#29756 closed defect (bug) (duplicate)
get_tags() returns incorrect variable type in tag object
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 4.0 |
| Component: | Taxonomy | Keywords: | |
| Focuses: | Cc: |
Description
I'm running a simple get_tags() and then looping through the tags as such:
<?php
$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;
endforeach;
?>
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)
Note: See
TracTickets for help on using
tickets.
Duplicate of #16101.