How to detect first visit of a user?
No, there’s nothing in the core like that. You can set a cookie and do it simply enough (warning: untested code follows). <?php function is_first_time() { if (isset($_COOKIE[‘_wp_first_time’]) || is_user_logged_in()) { return false; } $domain = COOKIE_DOMAIN ? COOKIE_DOMAIN : $_SERVER[‘HTTP_HOST’]; // expires in 30 days. setcookie(‘_wp_first_time’, ‘1’, time() + (WEEK_IN_SECONDS * 4), “https://wordpress.stackexchange.com/”, $domain); … Read more