[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
Tue Aug 27 01:58:31 UTC 2013
#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: Awaiting Review
Component: General | Version: 3.0
Severity: normal | Resolution:
Keywords: has-patch |
-------------------------+------------------------------
Comment (by nacin):
Interesting. We've discussed this before, in #15178, then in #19243. I
never saw this ticket, but it turns out it is probably the best immediate
solution. I'd prefer to change the return value to `false` from `''` (as
stated in #15178) but I feel like that could break things. exists() would
be nice too but this would be an immediate thing.
Part of the issue found in #19243 is that fill_query_vars() sets a bunch
of query variables to `''`. This is in part due to the ability to call
parse_query() and get_posts() more than once in a single WP_Query instance
(which is weird, nonetheless), so there needs to be some reset. The issue
here would be that a $default of something other than `''` would never be
hit for a default "filled" query variable. Which is why this isn't a
straight commit. But I'd love to resolve it.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/16471#comment:5>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list