WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#9193 closed defect (bug) (fixed)

get_terms() in wp_tag_cloud() didn't return a int

Reported by: alexrabe Owned by: ryan
Milestone: 2.8 Priority: low
Severity: normal Version: 2.7
Component: Taxonomy Keywords: has-patch taxonomy get_term_link wp_tag_cloud
Focuses: Cc:

Description

I took me a while, and I hope my analyse is correct. I try to use wp_tag_cloud() for my own taxonomy, but I'm not able to get a vaild term link. In get_term_link() i found that it look for a int|string|object. The term->id must be a int, but get_terms() in wp_tag_cloud() return a string array, so it's not possible to get the correct link.

Attched patch change the check from is_int -> is_numeric

Attachments (2)

taxonomy.patch (434 bytes) - added by alexrabe 7 years ago.
is_numeric instead is_int
term_as_integer.9193.diff (531 bytes) - added by filosofo 7 years ago.

Download all attachments as: .zip

Change History (6)

@alexrabe7 years ago

is_numeric instead is_int

comment:1 @filosofo7 years ago

I think the problem with checking is_numeric is that you're going to include searches for terms that might be numeric.

Better to address the problem at the source and pass an integer to get_term_link, when that's what you want. My patch should do that; does it solve your problem?

comment:2 @filosofo7 years ago

  • Keywords has-patch taxonomy get_term_link wp_tag_cloud added

comment:3 @alexrabe7 years ago

Of course this is another way and it will work for me as well

comment:4 @ryan7 years ago

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

(In [10613]) Force term ID to be an int. Props filosofo. fixes #9193

Note: See TracTickets for help on using tickets.