Created
April 17, 2012 09:10
-
-
Save Knivrobot/2404780 to your computer and use it in GitHub Desktop.
Use session cookies in 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
//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
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