Make WordPress Core

Opened 13 months ago

Last modified 3 weeks ago

#23862 reopened defect (bug)

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

Reported by: prettyboymp Owned by: nacin
Milestone: Future Release Priority: normal
Severity: trivial 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 13 months ago.

Download all attachments as: .zip

Change History (13)

prettyboymp13 months ago

comment:1 prettyboymp13 months ago

  • Keywords has-patch added

comment:2 SergeyBiryukov13 months ago

  • Milestone changed from Awaiting Review to 3.6

comment:3 alex-ye13 months ago

  • Cc nashwan.doaqan@… added

comment:4 ryan11 months ago

  • Milestone changed from 3.6 to Future Release

comment:5 nacin3 months ago

  • Component changed from General to Query

comment:6 nacin3 months ago

  • Milestone changed from Future Release to 3.9

comment:7 nacin3 months ago

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

comment:8 nacin3 weeks 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.

comment:9 nacin3 weeks 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.

comment:10 nacin3 weeks 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.

comment:11 nacin3 weeks ago

In 27768:

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

comment:12 nacin3 weeks 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.

Note: See TracTickets for help on using tickets.