[wp-trac] [WordPress Trac] #27764: the_terms() - update phpDocs and add "array" to $taxonomy parameter

WordPress Trac noreply at wordpress.org
Mon Apr 21 13:06:58 UTC 2014


#27764: the_terms() - update phpDocs and add "array" to $taxonomy parameter
--------------------------------+------------------------------
 Reporter:  ramiy               |       Owner:
     Type:  defect (bug)        |      Status:  new
 Priority:  normal              |   Milestone:  Awaiting Review
Component:  Taxonomy            |     Version:  3.8.2
 Severity:  normal              |  Resolution:
 Keywords:  dev-feedback close  |     Focuses:  docs
--------------------------------+------------------------------
Changes (by SergeyBiryukov):

 * keywords:  dev-feedback => dev-feedback close


Comment:

 Passing an array of taxonomies to `the_terms()` leads to some issues:
 1. It causes array to string conversion for [source:tags/3.9/src/wp-
 includes/category-template.php#L1293 term_links-$taxonomy] filter, making
 it `'term_links-Array'`.
 2. It causes the same conversion in [source:tags/3.9/src/wp-
 includes/taxonomy.php#L3243 get_object_term_cache()] and
 [source:tags/3.9/src/wp-includes/category-template.php#L1242
 get_the_terms()], resulting in `'Array_relationships'` cache key.
 3. It breaks anyone's code using [source:tags/3.9/src/wp-includes
 /category-template.php#L1326 the_terms] or [source:tags/3.9/src/wp-
 includes/category-template.php#L1248 get_the_terms] filters and only
 expecting a string in `$taxonomy` argument.

 So, the documentation is correct, string is the only valid option
 currently here.

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


More information about the wp-trac mailing list