[wp-trac] [WordPress Trac] #26234: Passing array of taxonomies to the_terms() triggers "array to string" conversion warning

WordPress Trac noreply at wordpress.org
Mon Nov 25 14:39:59 UTC 2013


#26234: Passing array of taxonomies to the_terms() triggers "array to string"
conversion warning
-----------------------------+-----------------------------
 Reporter:  johnjamesjacoby  |      Owner:
     Type:  defect (bug)     |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Taxonomy         |    Version:  2.2
 Severity:  normal           |   Keywords:  2nd-opinion
-----------------------------+-----------------------------
 To duplicate in a loop, call:

 {{{
 the_terms( get_the_ID(), array( 'category', 'post_tag' ) );
 }}}

 I expected to output the terms for a post across multiple taxonomies.
 Instead, an array to string conversion warning is returned.

 I've narrowed this down to an inconsistency in the way caching is handled
 between `update_object_term_cache()` and `get_object_term_cache()`, namely
 that `update` handles multiple taxonomies and relationships, and `get`
 assumes only one taxonomy is passed.

 The call stack to the error looks something like:

 * the_terms()
 * get_the_term_list()
 * get_the_terms()
 * get_object_term_cache()

 Each of the functions in the above stack safely handles multiple
 taxonomies, except for `get_object_term_cache().` If
 `get_object_term_cache()` were fixed, `wp_get_object_terms()` would fire
 (which also safely handles multiple taxonomies) and `the_terms()` would
 work as I expected.

--
Ticket URL: <http://core.trac.wordpress.org/ticket/26234>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list