I have a page tamplate "products"
<?php
/*
* Template Name: products
* Description: A Page Template.
*/
?>
I want to pass an argument from Single.php to the page template (products), So for that I create a funtion to filter query_vars
:
function add_custom_query_var( $vars ){
$vars[] = "prod";
return $vars;
}
add_filter( 'query_vars', 'add_custom_query_var' );
then I write this url in my Single page (single.php)
<a href="<?php echo add_query_arg( 'prod', "my_arg", site_url( '/products/' ) )?>"> test link </a>
but I get Not Found URL.
Any advice ?? Thanks.