I wish to create a new variable as described in the codex ,
but on submission of the URL thethe variables are submitted twice to my function
iI have tried this within a plugin also a the functionfunction.php
.php i I have also tried to use wp_reset_query()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');:
}
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');
}
}