Skip to content

Instantly share code, notes, and snippets.

@Knivrobot
Created April 17, 2012 09:10
Show Gist options
  • Save Knivrobot/2404780 to your computer and use it in GitHub Desktop.
Save Knivrobot/2404780 to your computer and use it in GitHub Desktop.
Use session cookies in Wordpress
//Enable sessions i wordpress
if ( !session_id() )
add_action( 'init', 'session_start' );
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