I would like to pass a variable between pages. This is a control variable for the whole site, lets call it season. This variable has a default value of the current season(custom variable in admin), and can be changed through a link. ( Some archive like url: …?season=1)
I would like this to be carried throughout the site, if set. So for example the link to page 1 would change from …?pageid=1 to …?pageid=1&season=1 . For all the links. Basically I whant this season to be the control variable on what content I display in each page.
How can this be done most simply in wordpress?
I also tried cookies and session, but had no success (to store this variable). What is the correct code in doing something like “Whatever the next page will be, pass this variable to it, so it will be readable in $_REQUEST”?
Thanks,
Sziro
Edit:
<?php
function get_season_ID()
{
if (array_key_exists('cat', $_REQUEST))
{
$c= $_REQUEST['cat'];
//I whant to pass $c to the next page whatever that is.
return $_REQUEST['cat'];
}
else
{
return get_custom('current_season_category_id');
}
}
?>
Why do you need the variable to be available in the
$_REQUEST
?If you’re setting the variable in the admin, I assume that means you’re saving it in the
wp_options
table. If it’s saved in the wp_options table, you can retrieve it usingget_option('season')
.