Opened 12 years ago
Closed 12 years ago
#29756 closed defect (bug) (duplicate)
get_tags() returns incorrect variable type in tag object
| Reported by: | jsavage37 | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Taxonomy | Version: | 4.0 |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Duplicate of #16101.