Can not access URL parameter in the frontpage
-
Hello everyone!
I try to get URL parameter in the frontpage but I does not work, however when using parameter in custom page in works.E.g It works in example.com/custompage/?someParamater=nay , but does not work in example.com/?someParameter=yay
I don’t use a simple _GET but WordPress functions (as I believe it is more secure? as I use it in get_posts later) The code I use:
First I define a filter in the functions:
function themeslug_query_vars( $qvars ) {
$qvars[] = 'someParameter';
return $qvars;
}
add_filter( 'query_vars', 'themeslug_query_vars' );Then I use it in my page as follows:
get_query_var('someParameter')
Thank you!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Can not access URL parameter in the frontpage’ is closed to new replies.