How to get a URL parameter from a URL with get_query_var?
I am trying to get a custom URL parameter from a URL in WordPress.
I add the following code to functions.php:
function add_query_vars_filter( $vars ){
$vars[] = token;
return $vars;
}
add_filter( 'query_vars', 'add_query_vars_filter' );
Then on the webpage I write:
?php $token = get_query_var( 'token', $default = ''); ?
h1Currently Browsing token ?php echo (int) $token; ? On a
static front page/h1
and go to the webpage http://www.negovista.com/tokensuccess/?token=xxxxxx
However on the page is only printed
'Currently Browsing token On a static front page' without the xxxxxx
Anyone knows if there is an error in the code?
Topic query-string Wordpress
Category Web