add_filter not working at all
-
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 insidefunctions.php
of my theme; and I try to access the variable usingget_query_vars( 'month' );
inside../theme_dir/includes/recent.php
. It returns nothing.Also I am using post name as my urls (
https://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 onquery_vars
but I knowadd_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.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘add_filter not working at all’ is closed to new replies.