query_vars
query_vars is a filter on the query variables used by the WP_Query class (and stored in $wp_request->public_query_vars).
The initial array consists of the following query variables:
m
p
posts
w
cat
withcomments
s
search
exact
sentence
debug
calendar
page
paged
more
tb
pb
author
order
orderby
year
monthnum
day
hour
minute
second
name
category_name
feed
author_name
static
pagename
page_id
error
comments_popup
attachment
attachment_id
subpost
subpost_id
preview
Your hook would accept an array, add an item to the array, and return the array.
function add_my_query_var($vars) {
$vars[] = ‘my_var’;
return $vars;
}
add_filter(‘query_vars’, ‘add_my_query_var’);