add_filter('query_vars', 'recent_queryvars' );
function recent_queryvars( $qvars ) {
$qvars[] = 'month';
return $qvars;
}
I have been trying to add the query variable of month with no success. The above code is inside functions.php of my theme; and I try to access the variable using get_query_vars( 'month' ); inside ../theme_dir/includes/recent.php. It returns nothing.
Also I am using post name as my urls (http://domain.com/sample-post/).
Please don't tell me how to just access the variable, the issue is with add_filter, it doesn't seem to work on query_vars but I know add_filter works because I use it to add a shortcode right above it in my functions file (see below).
Hopefully someone can tell me what's wrong.