[wp-trac] [WordPress Trac] #31174: The get_terms() argument "fields" renders "get_terms_fields" & "terms_clauses" filter callbacks useless

WordPress Trac noreply at wordpress.org
Fri Jan 30 02:42:32 UTC 2015


#31174: The get_terms() argument "fields" renders "get_terms_fields" &
"terms_clauses" filter callbacks useless
--------------------------+------------------------------
 Reporter:  F J Kaiser    |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Taxonomy      |     Version:  4.1
 Severity:  normal        |  Resolution:
 Keywords:  close         |     Focuses:
--------------------------+------------------------------
Changes (by boonebgorges):

 * keywords:   => close


Comment:

 F J Kaiser - Thanks for the very detailed and helpful bug report.

 The filter was introduced in [11037], and I'm not sure it's ever worked
 properly. See https://core.trac.wordpress.org/browser/trunk/wp-
 includes/taxonomy.php?annotate=blame&rev=11037#L773. Even then, passing
 'ids' or 'names' for the value of 'fields' would override any changes
 applied in a 'get_terms_fields' filter, though back then there were fewer
 supported values of 'fields'.

 I'm leaning toward wontfix here. IMO this is a pretty crummy filter anyway
 - it seems much better to have a more robust 'fields' parameter. Moreover,
 I think the 'fields' param - aside from 'names' and 'ids', which return
 flat arrays - are not very useful or helpful. If 'fields=all' gets you
 more data than you need, just ignore the excess. I guess people want to
 specify the fields in order to reduce the memory footprint of the query.
 But the savings are really marginal; and when you don't do 'fields=all',
 you don't get full cache support, so you're potentially shooting yourself
 in the foot anyway. If I could rip this filter out without breaking
 things, I would :) As it is, it's working fine for 'all' and 'count' (as
 you note), so I think we should just leave it as it is.

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


More information about the wp-trac mailing list