[wp-trac] [WordPress Trac] #16471: Support default values for non-existant query vars in get_query_var() et al

WordPress Trac noreply at wordpress.org
Sun Feb 2 06:33:18 UTC 2014


#16471: Support default values for non-existant query vars in get_query_var() et al
-------------------------+------------------
 Reporter:  hakre        |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  3.9
Component:  Query        |     Version:  3.0
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |     Focuses:
-------------------------+------------------

Comment (by nacin):

 Replying to [comment:9 wonderboymusic]:
 > Can someone add a concrete example of why this matters? I don't see the
 benefit.
 >
 > `get_query_var( 'post_type', 9 )` <--- what does that accomplish?

 It ''can'' be helpful in some situations where a query variable is an "add
 on" — it has a default value that is otherwise assumed. "post_type" is
 probably not a great example. Ordering is, as are a number of other QVs.

 It is absolutely helpful when working with endpoints. #15178, #19243, both
 quoted above.

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


More information about the wp-trac mailing list