I wish to create a new variable as described in the codex, but on submission of the URL the variables are submitted twice to my function
I have tried this within a plugin also a the function.php
. I have also tried to use wp_reset_query()
Here is my sample code:
add_filter('query_vars', 'my_function');
function my_function ($vars) {
$vars[] = 'Q1';
$vars[] = 'Q2';
return $vars;
}
add_action('parse_query', 'query_var');
function query_var () {
if (get_query_var('Q1')){
echo ('hello');
}
}