Allow user to select location and then set cookie for location in WordPress
This code will set a cookie that essentially doesn’t expire. Adjust the time value to make it expire sooner: $cookiename = “ChocalateChip”; $cookievalue = “This is a tasty cookie value”; setcookie($cookienme, json_encode($cookievalue), time() + (86400 * 30*365*6), “https://wordpress.stackexchange.com/”);