[wp-trac] [WordPress Trac] #37292: Check if $category is object before outputting

WordPress Trac noreply at wordpress.org
Wed Sep 21 12:58:48 UTC 2016


#37292: Check if $category is object before outputting
--------------------------+----------------------
 Reporter:  michalzuber   |       Owner:
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  Taxonomy      |     Version:
 Severity:  normal        |  Resolution:  wontfix
 Keywords:                |     Focuses:
--------------------------+----------------------
Changes (by SergeyBiryukov):

 * status:  new => closed
 * resolution:   => wontfix
 * milestone:  Awaiting Review =>


Comment:

 The patch is for `get_the_category_list()`, which retrieves the
 `$categories` array via `get_the_category()`.

 `get_the_category()` always returns an array of objects, so if invalid
 data is encountered, it's likely because a plugin or theme did something
 wrong with the `the_category_list`, `get_the_terms`, or
 `wp_get_object_terms` filter, which would be a developer error.

 I don't think we should hide developer errors, a notice seems perfectly
 fine here. Feel free to reopen if you can still reproduce the issue on a
 clean install with no plugins installed and a default theme activated.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/37292#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list