Opened 12 years ago
Closed 10 years ago
#28024 closed defect (bug) (worksforme)
WordPress doesn't honor array query vars
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 2.1 |
| Component: | Query | Keywords: | |
| Focuses: | Cc: |
Description
Since r4753, we're discarding arrays from the query vars. This makes the query_vars filter useless in the event one is hoping to let WP parse and retrieve array variables passed in e.g. a form related to a custom post type.
Was there any good reason to do this, or was it simply premature and overzealous sanitization?
Change History (5)
#2
in reply to:
↑ 1
@
12 years ago
Replying to wonderboymusic:
Where is this not working?
add_action('template_redirect', function () {
global $wp;
var_dump($wp->query_string);
die;
});
Can't recall which WP function I needed that relied on query_string, but that was the issue.
Note: See
TracTickets for help on using
tickets.
Where is this not working?
add_filter( 'query_vars', function ( $vars ) { $vars[] = 'denis'; return $vars; } ); add_action( 'template_redirect', function () { var_dump( get_query_var( 'denis' ) ); exit(); } );Navigate to:
http://wordpress-core-develop/?denis[woo]=foo&denis[hoo]=barResult:
array(2) { ["woo"]=> string(3) "foo" ["hoo"]=> string(3) "bar" }pre_get_postsalso works with arrays...