Skip to content

Instantly share code, notes, and snippets.

@asterion
Created June 15, 2017 20:10
Show Gist options
  • Save asterion/caf0e352a8b7829ae6219473a6c98615 to your computer and use it in GitHub Desktop.
Save asterion/caf0e352a8b7829ae6219473a6c98615 to your computer and use it in GitHub Desktop.
cookie set wordpress
<?php
add_action( 'init', 'set_cookies_banner' );
function set_cookies_banner() {
$banner_id = 1;
if (isset($_GET['banner_id']) && is_numeric($_GET['banner_id'])) {
$banner_id = $_GET['banner_id'];
}
setcookie( 'banner_id', $banner_id, time() + (7*24*60*60) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment