Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#20049 closed defect (bug) (fixed)

WP_Query should use WP_Query::is_admin, not is_admin(), to add protected statuses

Reported by: nacin Owned by: nacin
Milestone: 3.4 Priority: normal
Severity: normal Version:
Component: Query Keywords:
Focuses: Cc:


WP_Query sets up an WP_Query::is_admin flag based on is_admin() in WP_Query::parse_query(). But it never uses it. When it goes to add protected post statuses, it checks is_admin() again.

To allow this to be easily filtered from the parse_query hook (something I plan to submit to the Debug Bar Console, as it uses admin-ajax which thinks it is is_admin), we should be using the query flag, not the function.

Attachments (1)

20049.diff (549 bytes) - added by nacin 6 years ago.

Download all attachments as: .zip

Change History (3)

6 years ago

#1 @ryan
6 years ago

Looks good.

#2 @nacin
6 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In [19932]:

Use is_admin WP_Query propery, not is_admin(), when adding protected post statuses to the query. Allows for overriding on the parse_query hook. fixes #20049.

Note: See TracTickets for help on using tickets.