I want to send a variable with a url and get the value and insert that value to a variable.
<a href="domain/newsletter-by-year?year=2020">GO TO THE NEWSLETTER FROM 2020</a>
ang get it in this url
https://domain/newsletter-by-year?year=2020
This is my wpquery
/* Template Name: newsletter_by_year */
$year = $_GET["year"];
$args = array(
'post_type' => 'post',
'category_name' => 'news-letter',
'posts_per_page' => 10,
'date_query' => array(
array(
'year' => $year,
),
),
);
$myQuery = new WP_Query($args);
but im getting a 404 page.