Created
June 15, 2017 20:10
-
-
Save asterion/caf0e352a8b7829ae6219473a6c98615 to your computer and use it in GitHub Desktop.
cookie set wordpress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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