I am adding a new query string parameter to be passed into the URL so that I can manipulate the REST API responses.
I added this to my functions.php
add_filter('query_vars', function ($vars) {
$vars[] = 'xyz';
return $vars;
});
This should make the parameter xyz available in the WP_Query object but it does not.
add_filter('pre_get_posts', function ($query) {
var_dump($query->query_vars);die;
});
The xyz property is not available in the query_vars however if I dump out the PHP $_GET array, it is there and has the value that I passed in, so I don't know why it wouldn't be making it into the query_vars. Any ideas?