[wp-trac] [WordPress Trac] #19243: Introduce WP_Query::exists(), or have WP_Query::get() return false for non-existence
WordPress Trac
wp-trac at lists.automattic.com
Mon Nov 14 21:18:09 UTC 2011
#19243: Introduce WP_Query::exists(), or have WP_Query::get() return false for non-
existence
-------------------------+-----------------------------
Reporter: nacin | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Query | Version:
Severity: normal | Keywords:
-------------------------+-----------------------------
See [ticket:15178#comment:8].
A query variable for an an endpoint with no value (/blah/, rather than
/feed/rss2/) is set, but it is empty. WP_Query::get() returns an empty
string when no QV is set, though, so you need to dig into
WP_Query::query_vars directly. This is annoying. It should return false
when the QV is not existence.
This should be rather backwards compatible, but WP_Query::exists() may be
desired (also, or instead of). In this case, it won't work for core query
vars, as _fill_query_vars() clears these, rather than unsets them. We
should either change how _fill_query_vars() works, or something.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/19243>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list