Opened 15 years ago
Closed 13 years ago
#17072 closed enhancement (maybelater)
Make $wp_query->query read-only
| Reported by: | scribu | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Query | Version: | |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
Description
WP_Query has two properties that contain query vars:
$wp_query->query is the initial query.
$wp_query->query_vars is the "working copy", with all possible query vars filled.
I propose we prevent modification of $wp_query->query and keep it as a signature of that particular instance.
Attachments (1)
Change History (6)
#2
@
15 years ago
We already discussed in IRC how we can't really make anything private that wasn't private before because it could break plugin functionality.
While this won't cause a WSOD it could break sites.
#3
@
15 years ago
We're not making it private, just read-only.
You can still call if ( 'foo' == $wp_query->query['foo'] ) etc.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Note that attempts to modify $wp_query->query will just trigger a notice: