-
-
Save tinotriste/5385149 to your computer and use it in GitHub Desktop.
Wordpress: Use session cookies
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 | |
//Enable sessions i wordpress | |
if ( !session_id() ) | |
add_action( 'init', 'session_start' ); | |
?> |
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 | |
session_start(); | |
if(isset($_SESSION['test'])) { | |
$_SESSION['test']='Hello again!'; | |
} else { | |
$_SESSION['test']='First time here'; | |
} | |
echo $_SESSION['test']; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment