[wp-trac] [WordPress Trac] #29756: get_tags() returns incorrect variable type in tag object

WordPress Trac noreply at wordpress.org
Thu Sep 25 21:13:52 UTC 2014


#29756: get_tags() returns incorrect variable type in tag object
--------------------------+-----------------------------
 Reporter:  jsavage37     |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  4.0
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 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.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/29756>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list