[wp-trac] [WordPress Trac] #25706: in_category() returns true if the first parameter is empty

WordPress Trac noreply at wordpress.org
Sat Oct 26 01:13:38 UTC 2013


#25706: in_category() returns true if the first parameter is empty
------------------------------------------+--------------------
 Reporter:  n.uddin.w                     |       Owner:
     Type:  defect (bug)                  |      Status:  new
 Priority:  normal                        |   Milestone:  3.7.1
Component:  Taxonomy                      |     Version:  3.7
 Severity:  normal                        |  Resolution:
 Keywords:  needs-patch needs-unit-tests  |
------------------------------------------+--------------------

Comment (by ericlewis):

 Replying to [comment:4 nacin]:
 > Did has_tag() return false at any point previously?

 No, it hasn't since its inception in 3.1. The long description of the
 has_term() is spot on here - "If no terms are given, determines if post
 has any terms." since it uses is_object_in_term(), which has that logic
 built into it. And since every category always has at least one term,
 that's why we're seeing the true return in the OP's example.

 Let's add the empty( $category ) check back into in_category() to fix the
 regression, and leave has_tag() as-is.

--
Ticket URL: <http://core.trac.wordpress.org/ticket/25706#comment:6>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list