[wp-trac] [WordPress Trac] #35265: get_the_terms return on non-existing term

WordPress Trac noreply at wordpress.org
Wed Dec 30 16:45:00 UTC 2015


#35265: get_the_terms return on non-existing term
--------------------------+------------------------
 Reporter:  tivnet        |       Owner:
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  General       |     Version:  4.4
 Severity:  normal        |  Resolution:  duplicate
 Keywords:                |     Focuses:
--------------------------+------------------------
Changes (by swissspidy):

 * milestone:  Awaiting Review =>


Comment:

 Replying to [comment:2 tivnet]:
 > {{{
 > * @return array|false|WP_Error Array of term objects on success, false
 if there are no terms
 > *                              or the post does not exist, WP_Error on
 failure.
 > }}}
 >
 > This description suggests that `false` should be returned.
 >
 > However, if I am not mistaken, I was getting `WP_Error` in this case
 before 4.4

 It clearly suggests that it returns either `false` ''or'' a `WP_Error`
 object, so I don't see a problem here.

 There are `is_wp_error` checks later on and the `get_the_terms` filter
 clearly says that `$terms` can be a `WP_Error` object.

 Long story short: Your patch prevents the `get_the_terms` filter being
 called, otherwise nothing else changes.

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


More information about the wp-trac mailing list