Make WordPress Core

Opened 11 years ago

Last modified 18 months ago

#23862 reopened defect (bug)

Clean up old WP->public_query_vars and WP->private_query_vars

Reported by: prettyboymp's profile prettyboymp Owned by: nacin's profile nacin
Milestone: Priority: normal
Severity: normal Version:
Component: Query Keywords: has-patch
Focuses: Cc:


There are some old non-working public_query_vars still in the WP class that should be cleaned up.

Also, since 'post_type' is now a public_query_var, it can be removed from the private_query_vars.

Attachments (1)

23862.diff (2.1 KB) - added by prettyboymp 11 years ago.

Download all attachments as: .zip

Change History (15)

11 years ago

#1 @prettyboymp
11 years ago

  • Keywords has-patch added

#2 @SergeyBiryukov
11 years ago

  • Milestone changed from Awaiting Review to 3.6

#3 @alex-ye
11 years ago

  • Cc nashwan.doaqan@… added

#4 @ryan
11 years ago

  • Milestone changed from 3.6 to Future Release

#5 @nacin
10 years ago

  • Component changed from General to Query

#6 @nacin
10 years ago

  • Milestone changed from Future Release to 3.9

#7 @nacin
10 years ago

Keep in mind it may be worth holding onto some of these as reserved terms for future use, like search.

#8 @nacin
10 years ago

I don't care much about static, pb, or even calendar, but I think it'd make sense for search and posts to remain reserved. (I wonder what pb was for.)

Going to clean up post_type and leave the others alone for now.

#9 @nacin
10 years ago

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

In 27738:

WP class: Remove duplication of the post_type query var, also specified as a public QV.

props prettyboymp.
fixes #23862.

#10 @nacin
10 years ago

  • Milestone changed from 3.9 to Future Release
  • Resolution fixed deleted
  • Status changed from closed to reopened

Alright, this actually broke a canonical unit test. (The noRewrite ?post_type=fake-cpt&p=1 one.)

WP::parse_request() parses public query vars and then parses private query vars. But in between there, it discards any post types that aren't publicly queryable. The canonical tests leverage WP::main() directly, and thus private query vars have outsized influence... It's kinda tough to explain, and was not fun to track down.

Anyway, as this was ostensibly for cleanup, and it clearly causes some side effects, I'm reverting.

#11 @nacin
10 years ago

In 27768:

Revert [27738] as the patient exhibited side effects. see #23862.

#12 @nacin
10 years ago

#27549 and #27547 — this definitely breaks things, in this case the admin which uses wp() and thus private query variables directly.

So at least for the post_type query variable, which is a particularly special case in the WP class, it's *not* invalid for it to be listed in public *and* private query variables.

#13 @chriscct7
9 years ago

  • Severity changed from trivial to normal

This ticket was mentioned in Slack in #core by peterwilsoncc. View the logs.

18 months ago

Note: See TracTickets for help on using tickets.