WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#8650 closed defect (bug) (invalid)

WP_Query::get_posts needs a filter on the query_vars

Reported by: AaronCampbell Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.7
Component: General Keywords: has-patch needs-testing
Focuses: Cc:

Description

You can filter the WHERE string after it's been assembled by WP_Query::get_posts but you can't filter the query vars that are used to build that string BEFORE it's built. It would be REALLY nice to have that ability, so that a plugin could simply adjust the query vars and still let WP_Query::get_posts build the WHERE (JOIN, etc).

Attachments (2)

8650.001.diff (507 bytes) - added by AaronCampbell 5 years ago.
Adds 'query_vars' filter
8650.001.2.diff (429 bytes) - added by filosofo 5 years ago.
making it viewable

Download all attachments as: .zip

Change History (6)

AaronCampbell5 years ago

Adds 'query_vars' filter

filosofo5 years ago

making it viewable

comment:1 filosofo5 years ago

What about 'parse_query'?

comment:2 ryan5 years ago

And 'query_string' for the main query.

comment:3 ryan5 years ago

There's already a query_vars filter in WP::parse_request(). That filters the vars for the main query. If you really need a filter within WP_query(), it needs to have a different name.

comment:4 ryan5 years ago

  • Milestone 2.7.1 deleted
  • Resolution set to invalid
  • Status changed from new to closed

If the existing query_vars filter does not suffice, re-open with a patch that avoids name collision.

Note: See TracTickets for help on using tickets.