[wp-trac] [WordPress Trac] #30879: wp_delete_object_term_relationships triggers PHP warning when object has no terms in taxonomy

WordPress Trac noreply at wordpress.org
Fri Jan 2 14:11:28 UTC 2015


#30879: wp_delete_object_term_relationships triggers PHP warning when object has no
terms in taxonomy
-------------------------------+------------------
 Reporter:  ragulka            |       Owner:
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  4.2
Component:  Taxonomy           |     Version:  4.1
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:
-------------------------------+------------------
Changes (by boonebgorges):

 * keywords:   => reporter-feedback


Comment:

 Actually, I take back the "confirmed". It turns out I could reproduce a
 PHP notice only if I used an invalid taxonomy (in which case
 `wp_get_object_terms()` returns a `WP_Error` object). In all other cases,
 `wp_get_object_terms()` returns an array, even if it's an empty array.

 ragulka, could you please double check what's happening here? Exactly what
 value is being passed to `array_map()`? If it turns out that it's a
 `WP_Error` object, we're going to have to get creative here, since the
 error provides a valuable notice to developers, but
 `wp_delete_object_term_relationships()` doesn't have a return value.

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


More information about the wp-trac mailing list