[wp-trac] [WordPress Trac] #33369: Cannot intelligently target using the `get_terms_args` filter

WordPress Trac noreply at wordpress.org
Fri Aug 14 00:37:06 UTC 2015

#33369: Cannot intelligently target using the `get_terms_args` filter
 Reporter:  johnjamesjacoby        |       Owner:
     Type:  feature request        |      Status:  new
 Priority:  normal                 |   Milestone:  Awaiting Review
Component:  Taxonomy               |     Version:  2.2
 Severity:  normal                 |  Resolution:
 Keywords:  has-patch 2nd-opinion  |     Focuses:

Comment (by knutsp):

 It could be argued that a function using defaults should return the same
 result when the argument was explicit and equal to the default, as when
 (deliberately) omitted. My trust in the documentation of a function would
 be damaged if I found this not to be true.

 In other words, I think `get_terms( 'mytax', array( 'ordery' => 'name' )
 )` and `get_terms( 'mytax' )` should return the same results when called
 in the same context, regardless of any filter.

 That is why I'm not sure that filters really should be informed on how the
 arguments was given, only their value after merging with defaults. The way
 WordPress uses `wp_parse_args()` resembles that of PHP when using optional

 Do you have a use case where this "knowledge" is the only way to do what
 you want?

 Are there any other filters in core that reveals the arguments as given
 before defaulting?

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

More information about the wp-trac mailing list