WordPress.org

Making WordPress.org

#3607 closed defect (duplicate)

Change the way public query vars are added for the handbooks and searchform

Reported by: keesiemeijer Owned by:
Milestone: Priority: normal
Component: Developer Hub Keywords: has-patch
Cc:

Description

The query_vars filter uses a numerically indexed array to store the public query vars. The handbook and the searchform are adding query vars as an associative array (with default values).

The following patch adds the query vars in the proper way.

This will not affect the way the query vars behave. Newly added query vars have a falsy value by default.

The question is if we even need to add them. There are no custom rewrite rules that use these query vars, and we don't use them as query args in the front end.

Attachments (1)

3607.patch (1.6 KB) - added by keesiemeijer 14 months ago.
Add query vars the proper way

Download all attachments as: .zip

Change History (3)

@keesiemeijer
14 months ago

Add query vars the proper way

#1 @dd32
14 months ago

I'm not even sure that these functions are doing anything of value, like, they can't even be used in rewrite rules if they wanted to be.

The only locations where the result of the filter is used, only uses the values and not the keys of the filter are used:
https://core.trac.wordpress.org/browser/trunk/src/wp-includes/class-wp.php?marks=287,295#L275
https://core.trac.wordpress.org/browser/trunk/src/wp-includes/rewrite.php?marks=596#L591

#2 @ocean90
14 months ago

  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #2882.

Note: See TracTickets for help on using tickets.