I set up cookie like this
function checkVisited(){
if ( !isset($_COOKIE['visited']) ) {
setcookie('visited', 'yes', time() + 3600*24*30, "/", "", "", TRUE);
define('visited', false);
}else{
define('visited', true);
}
}
add_action("init", "checkVisited");
Then in HTML:
<?php if(!visited): ?>
<div class="popup">
...
</div>
<?php endif; ?>
It works on Windows, but doesn't work for iOS/Chrome. And this issue appearing only on WP Engine server.
I see the cookie in browser tools, but var_dump($_COOKIE['visited'])
returns NULL
.