setting a temp variable
-
I’m opening a link using form action
<form action=”https://mydomain.com/index.php/shop/” method=”post” name=”ordertype”><input name=”ordertype” type=”submit” value=”local_pickup” /></form>
This allows me to set ordertype variable. But obviously its lost on page refresh.
Now, I can set this to a temp variable using $ordertype=$_POST[“ordertype”];
//Display Loggedin User
add_filter( ‘wp_nav_menu_items’, ‘my_custom_menu_item’);
function my_custom_menu_item($items){
if(is_user_logged_in())
{
$ordertype=$_POST[“ordertype”];
$user=wp_get_current_user();
…I’ve placed it in a Filter which displays the logged in used but I think that filer is called every page load !
Where can I do this so its only once ?
- The topic ‘setting a temp variable’ is closed to new replies.